Upgrade azure artifacts and update docs

This commit is contained in:
Bruno Borges
2018-05-29 17:06:20 -07:00
committed by Dave Syer
parent d322643433
commit 37d0d9500d
8 changed files with 55 additions and 107 deletions

View File

@@ -118,98 +118,6 @@ one-per-jar. It's up to the developer to choose. An app with multiple
functions can be deployed multiple times in different "personalities",
exposing different functions over different physical transports.
== Dynamic Compilation
There is a sample app that uses the function compiler to create a
function from a configuration property. The vanilla "function-sample"
also has that feature. And there are some examples that you can run to
see the compilation happening at run time. To run these examples,
change into the `scripts` directory:
----
cd scripts
----
Also, start a RabbitMQ server locally (e.g. execute `rabbitmq-server`).
=== Start the Function Registry Service:
----
./function-registry.sh
----
=== Register a Function:
----
./registerFunction.sh -n uppercase -f "f->f.map(s->s.toString().toUpperCase())"
----
=== Run a REST Microservice using that Function:
----
./web.sh -f uppercase -p 9000
curl -H "Content-Type: text/plain" -H "Accept: text/plain" localhost:9000/uppercase -d foo
----
=== Register a Supplier:
----
./registerSupplier.sh -n words -f "()->Flux.just(\"foo\",\"bar\")"
----
=== Run a REST Microservice using that Supplier:
----
./web.sh -s words -p 9001
curl -H "Accept: application/json" localhost:9001/words
----
=== Register a Consumer:
----
./registerConsumer.sh -n print -t String -f "System.out::println"
----
=== Run a REST Microservice using that Consumer:
----
./web.sh -c print -p 9002
curl -X POST -H "Content-Type: text/plain" -d foo localhost:9002/print
----
=== Run Stream Processing Microservices:
First register a streaming words supplier:
----
./registerSupplier.sh -n wordstream -f "()->Flux.interval(Duration.ofMillis(1000)).map(i->\"message-\"+i)"
----
Then start the source (supplier), processor (function), and sink (consumer) apps
(in reverse order):
----
./stream.sh -p 9103 -i uppercaseWords -c print
./stream.sh -p 9102 -i words -f uppercase -o uppercaseWords
./stream.sh -p 9101 -s wordstream -o words
----
The output will appear in the console of the sink app (one message per second, converted to uppercase):
----
MESSAGE-0
MESSAGE-1
MESSAGE-2
MESSAGE-3
MESSAGE-4
MESSAGE-5
MESSAGE-6
MESSAGE-7
MESSAGE-8
MESSAGE-9
...
----
== Building
:jdkversion: 1.7

View File

@@ -1,4 +1,7 @@
The adapter has a generic http request handler that you can use.
This project provides an adapter layer for a Spring Cloud Function application onto Azure.
You can write an app with a single `@Bean` of type `Function` and it will be deployable in Azure if you get the JAR file laid out right.
The adapter has a generic HTTP request handler that you can use optionally.
There is a `AzureSpringBootRequestHandler` which you must extend, and provide the input and output types as type parameters (enabling Azure to inspect the class and do the JSON conversions itself).
If your app has more than one `@Bean` of type `Function` etc. then you can choose the one to use by configuring `function.name`.

View File

@@ -1,4 +1,8 @@
This project provides an adapter layer for a Spring Cloud Function application onto Azure.
You can write an app with a single `@Bean` of type `Function` and it will be deployable in Azure if you get the JAR file laid out right.
include::azure-intro.adoc[]
include::azure-intro.adoc[]
== Sample Function
Go to the link:../../spring-cloud-function-samples/function-sample-azure/[function-sample-azure] to learn about how the sample works, and how to run and test it.

View File

@@ -3,7 +3,10 @@
This project provides an adapter layer for a Spring Cloud Function application onto Azure.
You can write an app with a single `@Bean` of type `Function` and it will be deployable in Azure if you get the JAR file laid out right.
The adapter has a generic http request handler that you can use.
This project provides an adapter layer for a Spring Cloud Function application onto Azure.
You can write an app with a single `@Bean` of type `Function` and it will be deployable in Azure if you get the JAR file laid out right.
The adapter has a generic HTTP request handler that you can use optionally.
There is a `AzureSpringBootRequestHandler` which you must extend, and provide the input and output types as type parameters (enabling Azure to inspect the class and do the JSON conversions itself).
If your app has more than one `@Bean` of type `Function` etc. then you can choose the one to use by configuring `function.name`.
@@ -70,4 +73,8 @@ The input type for the function in the Azure sample is a Foo with a single prope
{
"value": "foobar"
}
----
----
== Sample Function
Go to the link:../../spring-cloud-function-samples/function-sample-azure/[function-sample-azure] to learn about how the sample works, and how to run and test it.

View File

@@ -19,7 +19,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<aws-lambda-events.version>1.2.1</aws-lambda-events.version>
<azure.functions.java.core.version>[1.0.0-beta-3,1.0.0)</azure.functions.java.core.version>
</properties>
<dependencies>
@@ -44,7 +44,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-functions-java-core</artifactId>
<version>[1.0.0-beta-1,1.0.0)</version>
<version>${azure.functions.java.core.version}</version>
</dependency>
</dependencies>

View File

@@ -0,0 +1,32 @@
You can run this sample locally, just like the other Spring Cloud Function samples:
----
mvn spring-boot:run
----
and `curl -H "Content-Type: text/plain" localhost:8080/function -d '{"value": "hello foobar"}'`.
To run locally on top of Azure Functions, and to deploy to your live Azure environment, you will need the Azure Functions Core Tools installed along with the Azure CLI (see https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-java-maven for more details).
Run Azure Function locally:
----
mvn azure-functions:run
----
To deploy the function on your live Azure environment:
----
$ az login
$ mvn azure-functions:deploy
----
On another terminal try this: `curl https://<azure-function-url-from-the-log>/api/uppercase -d '{"value": "hello foobar!"}'`. Please ensure that you use the right URL for the function above. Alternatively you can test the function in the Azure Dashboard UI (click on the function name, go to the right hand side and click "Test" and to the bottom right, "Run").
The input type for the function in the Azure sample is a Foo with a single property called "value". So you need this to test it with something like below:
----
{
"value": "foobar"
}
----

View File

@@ -23,6 +23,7 @@
<maven.compiler.target>1.8</maven.compiler.target>
<functionAppName>function-sample-azure</functionAppName>
<functionAppRegion>westus</functionAppRegion>
<functionResourceGroup>java-function-group</functionResourceGroup>
<reactor.version>3.1.2.RELEASE</reactor.version>
<start-class>example.Config</start-class>
</properties>
@@ -37,12 +38,6 @@
<artifactId>spring-cloud-starter-function-web</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-functions-java-core</artifactId>
<version>1.0.0-beta-2</version>
<scope>provided</scope>
</dependency>
<!-- Test -->
<dependency>
@@ -74,7 +69,7 @@
<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-functions-maven-plugin</artifactId>
<version>0.1.6</version>
<version>1.0.0-beta-1</version>
</plugin>
</plugins>
</pluginManagement>
@@ -91,7 +86,7 @@
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-functions-maven-plugin</artifactId>
<configuration>
<resourceGroup>java-functions-group</resourceGroup>
<resourceGroup>${functionResourceGroup}</resourceGroup>
<appName>${functionAppName}</appName>
<region>${functionAppRegion}</region>
<appSettings>

View File

@@ -8,7 +8,6 @@
"direction": "in",
"authLevel": "anonymous",
"methods": [
"get",
"post"
]
},