diff --git a/spring-cloud-function/3.0.0.M1/azure.html b/spring-cloud-function/3.0.0.M1/azure.html index bdbcb8eb..1c375f88 100644 --- a/spring-cloud-function/3.0.0.M1/azure.html +++ b/spring-cloud-function/3.0.0.M1/azure.html @@ -90,6 +90,7 @@ $(addBlockSwitches); @@ -102,7 +103,7 @@ $(addBlockSwitches);

3.0.0.M1

The Azure adapter bootstraps a Spring Cloud Function context and channels function calls from the Azure framework into the user functions, using Spring Boot configuration where necessary. Azure Functions has quite a unique, but invasive programming model, involving annotations in user code that are specific to the platform. The easiest way to use it with Spring Cloud is to extend a base class and write a method in it with the @FunctionName annotation which delegates to a base class method.

@@ -167,7 +168,84 @@ public Function<Foo, Bar> uppercase(ExecutionContext targetContext) {

Notes on JAR Layout

-

You don’t need the Spring Cloud Function Web at runtime in Azure, so you can exclude this before you create the JAR you deploy to Azure, but it won’t be used if you include it so it doesn’t hurt to leave it in. 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 can exclude this +before you create the JAR you deploy to Azure, but it won’t be used if you include it, so +it doesn’t hurt to leave it in. 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.

+
+
+
+

Build file setup

+
+
+

In order to run Spring Cloud Function applications on Microsoft Azure, you can leverage the Maven +plugin offered by the cloud platform provider.

+
+
+

In order to use the adapter plugin for Maven, add the plugin dependency to your pom.xml +file:

+
+
+
+
<dependencies>
+	<dependency>
+		<groupId>org.springframework.cloud</groupId>
+		<artifactId>spring-cloud-function-adapter-azure</artifactId>
+	</dependency>
+</dependencies>
+
+
+
+

Then, configure the plugin. You will need to provide Azure-specific configuration for your +application, specifying the resourceGroup, appName and other optional properties, and + add the package goal execution so that the function.json file required by Azure is + generated for you. Full plugin documentation can be found in the plugin repository.

+
+
+
+
<plugin>
+	<groupId>com.microsoft.azure</groupId>
+	<artifactId>azure-functions-maven-plugin</artifactId>
+	<configuration>
+		<resourceGroup>${functionResourceGroup}</resourceGroup>
+		<appName>${functionAppName}</appName>
+	</configuration>
+	<executions>
+		<execution>
+			<id>package-functions</id>
+			<goals>
+				<goal>package</goal>
+			</goals>
+		</execution>
+	</executions>
+</plugin>
+
+
+
+

You will also have to ensure that the files to be scanned by the plugin can be found in the +Azure functions staging directory (see the plugin repository + for more details on the staging directory and it’s default location).

+
+
+

You can find the entire sample pom.xml file for deploying Spring Cloud Function +applications to Microsoft Azure with Maven here.

+
+
+ + + + + +
+ + +As of yet, only Maven plugin is available. Gradle plugin has not been created by +the cloud platform provider. +
+