diff --git a/README.adoc b/README.adoc index 4bf63fd4c..db227d7fe 100644 --- a/README.adoc +++ b/README.adoc @@ -183,16 +183,10 @@ http://eclipse.org/m2e/[m2eclipse] eclipse plugin for maven support. Other IDEs should also work without issue as long as they use Maven 3.3.3 or better. ==== Importing into eclipse with m2eclipse - We recommend the http://eclipse.org/m2e/[m2eclipse] eclipse plugin when working with eclipse. If you don't already have m2eclipse installed it is available from the "eclipse marketplace". -Also, you will need to install Kotlin plug-in from the "eclipse marketplace" to ensure projects -that depend on Kotlin complile under `m2eclipse` plugin (mentioned above). - -NOTE: If you still see compile errors after installing Kotlin plugin, simply right-click on the project with error and _remove_ and then _add_ Kotlin Nature via ***Configure Kotlin*** feature. - NOTE: Older versions of m2e do not support Maven 3.3, so once the projects are imported into Eclipse you will also need to tell m2eclipse to use the right profile for the projects. If you @@ -260,4 +254,4 @@ added after the original pull request but before a merge. other target branch in the main project). * When writing a commit message please follow http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html[these conventions], if you are fixing an existing issue please add `Fixes gh-XXXX` at the end of the commit - message (where XXXX is the issue number). + message (where XXXX is the issue number). \ No newline at end of file diff --git a/docs/pom.xml b/docs/pom.xml index 238b06a23..ef4a6950a 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-function-parent - 2.0.0.BUILD-SNAPSHOT + 2.0.0.M2 pom Spring Cloud Function Docs diff --git a/pom.xml b/pom.xml index ee4f563d9..b242b540e 100644 --- a/pom.xml +++ b/pom.xml @@ -4,13 +4,13 @@ spring-cloud-function-parent Spring Cloud Function Parent - 2.0.0.BUILD-SNAPSHOT + 2.0.0.M2 pom org.springframework.cloud spring-cloud-build - 2.1.0.BUILD-SNAPSHOT + 2.1.0.M2 @@ -18,7 +18,7 @@ 1.8 2.0.0.RELEASE 1.0.12.RELEASE - 2.1.0.BUILD-SNAPSHOT + 2.1.0.M3 spring-cloud-function Californium-RC1 diff --git a/spring-cloud-function-adapters/pom.xml b/spring-cloud-function-adapters/pom.xml index 8999ff418..25d3989cc 100644 --- a/spring-cloud-function-adapters/pom.xml +++ b/spring-cloud-function-adapters/pom.xml @@ -9,7 +9,7 @@ org.springframework.cloud spring-cloud-function-parent - 2.0.0.BUILD-SNAPSHOT + 2.0.0.M2 spring-cloud-function-adapter-parent diff --git a/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/pom.xml b/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/pom.xml index 086f89bf0..3692fe84f 100644 --- a/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/pom.xml +++ b/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/pom.xml @@ -12,7 +12,7 @@ org.springframework.cloud spring-cloud-function-adapter-parent - 2.0.0.BUILD-SNAPSHOT + 2.0.0.M2 diff --git a/spring-cloud-function-adapters/spring-cloud-function-adapter-azure/README.adoc b/spring-cloud-function-adapters/spring-cloud-function-adapter-azure/README.adoc index 2e297ddcc..bf93ca31a 100644 --- a/spring-cloud-function-adapters/spring-cloud-function-adapter-azure/README.adoc +++ b/spring-cloud-function-adapters/spring-cloud-function-adapter-azure/README.adoc @@ -3,31 +3,44 @@ 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. -There is a `AzureSpringBootRequestHandler` which you must extend, and provide the input and output types as annotated method parameters (enabling Azure to inspect the class and create JSON bindings). The base class has two useful methods (`handleRequest` and `handleOutput`) to which you can delegate the actual function call, so mostly the function will only ever have one line. +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. -Example: +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). -```java -public class FooHandler extends AzureSpringBootRequestHandler { - @FunctionName("uppercase") - public Bar execute( - @HttpTrigger(name = "req", methods = { HttpMethod.GET, - HttpMethod.POST }, authLevel = AuthorizationLevel.ANONYMOUS) - Foo foo, - ExecutionContext context) { - return handleRequest(foo, context); - } -} -``` - -This Azure handler will delegate to a `Function` bean (or a `Function,Publisher>`). Some Azure triggers (e.g. `@CosmosDBTrigger`) result in a input type of `List` and in that case you can bind to `List` in the Azure handler, or `String` (the raw JSON). The `List` input delegates to a `Function` with input type `Map`, or `Publisher` or `List` of the same type. The output of the `Function` can be a `List` (one-for-one) or a single value (aggregation), and the output binding in the Azure declaration should match. - -If your app has more than one `@Bean` of type `Function` etc. then you can choose the one to use by configuring `function.name`. Or if you make the `@FunctionName` in the Azure handler method match the function name it should work that way (also for function apps with multiple functions). The functions are extracted from the Spring Cloud `FunctionCatalog`. +If your app has more than one `@Bean` of type `Function` etc. then you can choose the one to use by configuring `function.name`. +The functions are extracted from the Spring Cloud `FunctionCatalog`. === Notes on JAR Layout -You don't need the Spring Cloud Function Web at runtime in Azure, so you can optionally exclude this before you create the JAR you deploy to Azure. -A function application on Azure is an archive generated by the Maven plugin. The function lives in the JAR file generated by this project. The sample creates it as an executable jar, using the thin layout, so that Azure can find the handler classes. If you prefer you can just use a regular flat JAR file. The dependencies should *not* be included. +You don't need the Spring Cloud Function Web at runtime in Azure, so you need to exclude this before you create the JAR you deploy to Azure. +A function application on Azure has to be shaded, but a Spring Boot standalone application does not, so you can run the same app using 2 separate jars (as per the sample here). +The sample app creates the shaded jar file, with an `azure` classifier for deploying in Azure. + +=== JSON Configuration + +The Azure tooling needs to find some JSON configuration files to tell it how to deploy and integrate the function (e.g. which Java class to use as the entry point, and which triggers to use). Those files can be created with the Maven plugin for a non-Spring function, but the tooling doesn't work yet with the adapter in its current form. There is an example `function.json` in the sample which hooks the function up as an HTTP endpoint: + +``` +{ + "scriptFile" : "../function-sample-azure-2.0.0.BUILD-SNAPSHOT-azure.jar", + "entryPoint" : "example.FooHandler.execute", + "bindings" : [ { + "type" : "httpTrigger", + "name" : "foo", + "direction" : "in", + "authLevel" : "anonymous", + "methods" : [ "get", "post" ] + }, { + "type" : "http", + "name" : "$return", + "direction" : "out" + } ], + "disabled" : false +} +``` + == Build @@ -45,13 +58,7 @@ You can run the sample locally, just like the other Spring Cloud Function sample and `curl -H "Content-Type: text/plain" localhost:8080/function -d '{"value": "hello foobar"}'`. -Or you can run locally in an Azure host: - ---- -./mvnw azure-functions:run ---- - -You will need the `az` and `func` CLI apps (see https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-java-maven for more detail). To deploy the function on Azure runtime: +You will need the `az` CLI app and some node.js fu (see https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-java-maven for more detail). To deploy the function on Azure runtime: ---- $ az login diff --git a/spring-cloud-function-adapters/spring-cloud-function-adapter-azure/pom.xml b/spring-cloud-function-adapters/spring-cloud-function-adapter-azure/pom.xml index 01dfb533f..322076287 100644 --- a/spring-cloud-function-adapters/spring-cloud-function-adapter-azure/pom.xml +++ b/spring-cloud-function-adapters/spring-cloud-function-adapter-azure/pom.xml @@ -13,7 +13,7 @@ org.springframework.cloud spring-cloud-function-adapter-parent - 2.0.0.BUILD-SNAPSHOT + 2.0.0.M2 diff --git a/spring-cloud-function-adapters/spring-cloud-function-adapter-openwhisk/pom.xml b/spring-cloud-function-adapters/spring-cloud-function-adapter-openwhisk/pom.xml index 78a1387f2..d4f7a6c95 100644 --- a/spring-cloud-function-adapters/spring-cloud-function-adapter-openwhisk/pom.xml +++ b/spring-cloud-function-adapters/spring-cloud-function-adapter-openwhisk/pom.xml @@ -12,7 +12,7 @@ org.springframework.cloud spring-cloud-function-adapter-parent - 2.0.0.BUILD-SNAPSHOT + 2.0.0.M2 diff --git a/spring-cloud-function-compiler/pom.xml b/spring-cloud-function-compiler/pom.xml index b5bc7ea39..1ad9c1d1e 100644 --- a/spring-cloud-function-compiler/pom.xml +++ b/spring-cloud-function-compiler/pom.xml @@ -10,7 +10,7 @@ org.springframework.cloud spring-cloud-function-parent - 2.0.0.BUILD-SNAPSHOT + 2.0.0.M2 diff --git a/spring-cloud-function-context/pom.xml b/spring-cloud-function-context/pom.xml index 79bb9cc66..db4670b5e 100644 --- a/spring-cloud-function-context/pom.xml +++ b/spring-cloud-function-context/pom.xml @@ -11,7 +11,7 @@ org.springframework.cloud spring-cloud-function-parent - 2.0.0.BUILD-SNAPSHOT + 2.0.0.M2 1.2.61 diff --git a/spring-cloud-function-core/pom.xml b/spring-cloud-function-core/pom.xml index b8dc8b992..f5ea59262 100644 --- a/spring-cloud-function-core/pom.xml +++ b/spring-cloud-function-core/pom.xml @@ -10,7 +10,7 @@ org.springframework.cloud spring-cloud-function-parent - 2.0.0.BUILD-SNAPSHOT + 2.0.0.M2 diff --git a/spring-cloud-function-dependencies/pom.xml b/spring-cloud-function-dependencies/pom.xml index e45546512..fa36388a2 100644 --- a/spring-cloud-function-dependencies/pom.xml +++ b/spring-cloud-function-dependencies/pom.xml @@ -5,11 +5,11 @@ spring-cloud-dependencies-parent org.springframework.cloud - 2.1.0.BUILD-SNAPSHOT + 2.1.0.M2 spring-cloud-function-dependencies - 2.0.0.BUILD-SNAPSHOT + 2.0.0.M2 pom Spring Cloud Function Dependencies Spring Cloud Function Dependencies diff --git a/spring-cloud-function-deployer/pom.xml b/spring-cloud-function-deployer/pom.xml index b067ae2b2..4f66780df 100644 --- a/spring-cloud-function-deployer/pom.xml +++ b/spring-cloud-function-deployer/pom.xml @@ -11,7 +11,7 @@ org.springframework.cloud spring-cloud-function-parent - 2.0.0.BUILD-SNAPSHOT + 2.0.0.M2 diff --git a/spring-cloud-function-deployer/src/it/support/pom.xml b/spring-cloud-function-deployer/src/it/support/pom.xml index 823acf6de..25aa064c2 100644 --- a/spring-cloud-function-deployer/src/it/support/pom.xml +++ b/spring-cloud-function-deployer/src/it/support/pom.xml @@ -11,13 +11,13 @@ org.springframework.boot spring-boot-starter-parent - 2.0.3.RELEASE + 2.1.0.M3 1.8 - 2.0.0.BUILD-SNAPSHOT + 2.0.0.M2 1.0.12.RELEASE diff --git a/spring-cloud-function-samples/function-sample-aws/pom.xml b/spring-cloud-function-samples/function-sample-aws/pom.xml index b75d66c74..71095f5c1 100644 --- a/spring-cloud-function-samples/function-sample-aws/pom.xml +++ b/spring-cloud-function-samples/function-sample-aws/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 2.0.3.RELEASE + 2.1.0.M3 @@ -25,7 +25,7 @@ 1.0.11.RELEASE 2.0.2 3.1.2.RELEASE - 2.0.0.BUILD-SNAPSHOT + 2.0.0.M2 example.Config diff --git a/spring-cloud-function-samples/function-sample-azure/pom.xml b/spring-cloud-function-samples/function-sample-azure/pom.xml index 34fe77b7b..36eb499a8 100644 --- a/spring-cloud-function-samples/function-sample-azure/pom.xml +++ b/spring-cloud-function-samples/function-sample-azure/pom.xml @@ -13,7 +13,7 @@ org.springframework.boot spring-boot-starter-parent - 2.0.3.RELEASE + 2.1.0.M3 diff --git a/spring-cloud-function-samples/function-sample-compiler/pom.xml b/spring-cloud-function-samples/function-sample-compiler/pom.xml index 361f8fc5c..48c13e46c 100644 --- a/spring-cloud-function-samples/function-sample-compiler/pom.xml +++ b/spring-cloud-function-samples/function-sample-compiler/pom.xml @@ -13,13 +13,13 @@ org.springframework.boot spring-boot-starter-parent - 2.0.2.RELEASE + 2.1.0.M3 1.8 - 2.0.0.BUILD-SNAPSHOT + 2.0.0.M2 Elmhurst.RELEASE 3.1.2.RELEASE 1.0.10.RELEASE diff --git a/spring-cloud-function-samples/function-sample-pof/pom.xml b/spring-cloud-function-samples/function-sample-pof/pom.xml index a09e0a6e7..655cfc734 100644 --- a/spring-cloud-function-samples/function-sample-pof/pom.xml +++ b/spring-cloud-function-samples/function-sample-pof/pom.xml @@ -12,7 +12,7 @@ org.springframework.boot spring-boot-starter-parent - 1.5.11.RELEASE + 2.1.0.M3 @@ -21,7 +21,7 @@ UTF-8 1.8 3.1.2.RELEASE - 2.0.0.BUILD-SNAPSHOT + 2.0.0.M2 diff --git a/spring-cloud-function-samples/function-sample-pojo/pom.xml b/spring-cloud-function-samples/function-sample-pojo/pom.xml index 2740181af..181e9f544 100644 --- a/spring-cloud-function-samples/function-sample-pojo/pom.xml +++ b/spring-cloud-function-samples/function-sample-pojo/pom.xml @@ -13,13 +13,13 @@ org.springframework.boot spring-boot-starter-parent - 2.0.3.RELEASE + 2.1.0.M3 1.8 - 2.0.0.BUILD-SNAPSHOT + 2.0.0.M2 1.0.13.RELEASE diff --git a/spring-cloud-function-samples/function-sample-task/pom.xml b/spring-cloud-function-samples/function-sample-task/pom.xml index 622dac08e..200bead71 100644 --- a/spring-cloud-function-samples/function-sample-task/pom.xml +++ b/spring-cloud-function-samples/function-sample-task/pom.xml @@ -13,13 +13,13 @@ org.springframework.boot spring-boot-starter-parent - 1.5.11.RELEASE + 2.1.0.M3 1.8 - 2.0.0.BUILD-SNAPSHOT + 2.0.0.M2 1.0.10.RELEASE 3.1.2.RELEASE diff --git a/spring-cloud-function-samples/function-sample/pom.xml b/spring-cloud-function-samples/function-sample/pom.xml index e807ac314..48dfaff36 100644 --- a/spring-cloud-function-samples/function-sample/pom.xml +++ b/spring-cloud-function-samples/function-sample/pom.xml @@ -13,13 +13,13 @@ org.springframework.boot spring-boot-starter-parent - 2.1.0.BUILD-SNAPSHOT + 2.1.0.M3 1.8 - 2.0.0.BUILD-SNAPSHOT + 2.0.0.M2 1.0.13.RELEASE diff --git a/spring-cloud-function-samples/pom.xml b/spring-cloud-function-samples/pom.xml index e8399cfcd..040c645bc 100644 --- a/spring-cloud-function-samples/pom.xml +++ b/spring-cloud-function-samples/pom.xml @@ -9,7 +9,7 @@ org.springframework.cloud spring-cloud-function-parent - 2.0.0.BUILD-SNAPSHOT + 2.0.0.M2 diff --git a/spring-cloud-function-task/pom.xml b/spring-cloud-function-task/pom.xml index 1438c217b..bbb281b62 100644 --- a/spring-cloud-function-task/pom.xml +++ b/spring-cloud-function-task/pom.xml @@ -10,7 +10,7 @@ org.springframework.cloud spring-cloud-function-parent - 2.0.0.BUILD-SNAPSHOT + 2.0.0.M2 diff --git a/spring-cloud-function-web/pom.xml b/spring-cloud-function-web/pom.xml index 1fa994faa..5fb65a60d 100644 --- a/spring-cloud-function-web/pom.xml +++ b/spring-cloud-function-web/pom.xml @@ -11,7 +11,7 @@ org.springframework.cloud spring-cloud-function-parent - 2.0.0.BUILD-SNAPSHOT + 2.0.0.M2 diff --git a/spring-cloud-starter-function-web/pom.xml b/spring-cloud-starter-function-web/pom.xml index 123b2ca80..c8720a416 100644 --- a/spring-cloud-starter-function-web/pom.xml +++ b/spring-cloud-starter-function-web/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-function-parent - 2.0.0.BUILD-SNAPSHOT + 2.0.0.M2 .. spring-cloud-starter-function-web diff --git a/spring-cloud-starter-function-webflux/pom.xml b/spring-cloud-starter-function-webflux/pom.xml index cdf7b4020..eefbe5fdd 100644 --- a/spring-cloud-starter-function-webflux/pom.xml +++ b/spring-cloud-starter-function-webflux/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-function-parent - 2.0.0.BUILD-SNAPSHOT + 2.0.0.M2 spring-cloud-starter-function-webflux spring-cloud-starter-function-webflux