Fix indentation for all pages
This commit is contained in:
@@ -3,21 +3,21 @@
|
|||||||
image::https://travis-ci.org/spring-cloud/spring-cloud-function.svg?branch={branch}[Build Status, link=https://travis-ci.org/spring-cloud/spring-cloud-function]
|
image::https://travis-ci.org/spring-cloud/spring-cloud-function.svg?branch={branch}[Build Status, link=https://travis-ci.org/spring-cloud/spring-cloud-function]
|
||||||
|
|
||||||
[[introduction]]
|
[[introduction]]
|
||||||
== Introduction
|
= Introduction
|
||||||
|
|
||||||
include::_intro.adoc[]
|
include::_intro.adoc[]
|
||||||
|
|
||||||
[[getting-started]]
|
[[getting-started]]
|
||||||
== Getting Started
|
= Getting Started
|
||||||
|
|
||||||
include::getting-started.adoc[]
|
include::getting-started.adoc[]
|
||||||
|
|
||||||
[[building]]
|
[[building]]
|
||||||
== Building
|
= Building
|
||||||
|
|
||||||
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/building.adoc[]
|
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/building.adoc[]
|
||||||
|
|
||||||
[[contributing]]
|
[[contributing]]
|
||||||
== Contributing
|
= Contributing
|
||||||
|
|
||||||
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing.adoc[]
|
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing.adoc[]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
:branch: master
|
:branch: master
|
||||||
|
|
||||||
[[aws-lambda]]
|
[[aws-lambda]]
|
||||||
=== AWS Lambda
|
= AWS Lambda
|
||||||
|
|
||||||
The https://aws.amazon.com/[AWS] adapter takes a Spring Cloud Function app and converts it to a form that can run in AWS Lambda.
|
The https://aws.amazon.com/[AWS] adapter takes a Spring Cloud Function app and converts it to a form that can run in AWS Lambda.
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@ The details of how to get stared with AWS Lambda is out of scope of this documen
|
|||||||
AWS and AWS Lambda and wants to learn what additional value spring provides.
|
AWS and AWS Lambda and wants to learn what additional value spring provides.
|
||||||
|
|
||||||
[[getting-started]]
|
[[getting-started]]
|
||||||
==== Getting Started
|
== Getting Started
|
||||||
|
|
||||||
One of the goals of Spring Cloud Function framework is to provide necessary infrastructure elements to enable a _simple function application_
|
One of the goals of Spring Cloud Function framework is to provide necessary infrastructure elements to enable a _simple function application_
|
||||||
to interact in a certain way in a particular environment.
|
to interact in a certain way in a particular environment.
|
||||||
@@ -59,7 +59,7 @@ to use. The next section will explain you how you can accomplish just that.
|
|||||||
|
|
||||||
|
|
||||||
[[aws-request-handlers]]
|
[[aws-request-handlers]]
|
||||||
==== AWS Request Handlers
|
== AWS Request Handlers
|
||||||
|
|
||||||
The adapter has a couple of generic request handlers that you can use. The most generic is (and the one we used in the Getting Started section)
|
The adapter has a couple of generic request handlers that you can use. The most generic is (and the one we used in the Getting Started section)
|
||||||
is `org.springframework.cloud.function.adapter.aws.FunctionInvoker` which is the implementation of AWS's `RequestStreamHandler`.
|
is `org.springframework.cloud.function.adapter.aws.FunctionInvoker` which is the implementation of AWS's `RequestStreamHandler`.
|
||||||
@@ -73,7 +73,7 @@ the framework will attempt to find a default following the search order where it
|
|||||||
|
|
||||||
|
|
||||||
[[aws-function-routing]]
|
[[aws-function-routing]]
|
||||||
==== AWS Function Routing
|
== AWS Function Routing
|
||||||
|
|
||||||
One of the core features of Spring Cloud Function is https://docs.spring.io/spring-cloud-function/docs/{project-version}/reference/html/spring-cloud-function.html#_function_routing_and_filtering[routing]
|
One of the core features of Spring Cloud Function is https://docs.spring.io/spring-cloud-function/docs/{project-version}/reference/html/spring-cloud-function.html#_function_routing_and_filtering[routing]
|
||||||
- an ability to have one special function to delegate to other functions based on the user provided routing instructions.
|
- an ability to have one special function to delegate to other functions based on the user provided routing instructions.
|
||||||
@@ -95,12 +95,12 @@ dots with underscores and hyphens with camel case. So for example `spring.cloud
|
|||||||
and `spring.cloud.function.routing-expression` becomes `spring_cloud_function_routingExpression`.
|
and `spring.cloud.function.routing-expression` becomes `spring_cloud_function_routingExpression`.
|
||||||
|
|
||||||
[[aws-function-routing-with-custom-runtime]]
|
[[aws-function-routing-with-custom-runtime]]
|
||||||
===== AWS Function Routing with Custom Runtime
|
=== AWS Function Routing with Custom Runtime
|
||||||
|
|
||||||
When using <<Custom Runtime>> Function Routing works the same way. All you need is to specify `functionRouter` as AWS Handler the same way you would use the name of the function as handler.
|
When using <<Custom Runtime>> Function Routing works the same way. All you need is to specify `functionRouter` as AWS Handler the same way you would use the name of the function as handler.
|
||||||
|
|
||||||
[[notes-on-jar-layout]]
|
[[notes-on-jar-layout]]
|
||||||
==== Notes on JAR Layout
|
== Notes on JAR Layout
|
||||||
|
|
||||||
You don't need the Spring Cloud Function Web or Stream adapter at runtime in Lambda, so you might
|
You don't need the Spring Cloud Function Web or Stream adapter at runtime in Lambda, so you might
|
||||||
need to exclude those before you create the JAR you send to AWS. A Lambda application has to be
|
need to exclude those before you create the JAR you send to AWS. A Lambda application has to be
|
||||||
@@ -165,14 +165,14 @@ then additional transformers must be configured as part of the maven-shade-plugi
|
|||||||
----
|
----
|
||||||
|
|
||||||
[[build-file-setup]]
|
[[build-file-setup]]
|
||||||
==== Build file setup
|
== Build file setup
|
||||||
|
|
||||||
In order to run Spring Cloud Function applications on AWS Lambda, you can leverage Maven or Gradle
|
In order to run Spring Cloud Function applications on AWS Lambda, you can leverage Maven or Gradle
|
||||||
plugins offered by the cloud platform provider.
|
plugins offered by the cloud platform provider.
|
||||||
|
|
||||||
|
|
||||||
[[maven]]
|
[[maven]]
|
||||||
===== Maven
|
=== Maven
|
||||||
|
|
||||||
In order to use the adapter plugin for Maven, add the plugin dependency to your `pom.xml`
|
In order to use the adapter plugin for Maven, add the plugin dependency to your `pom.xml`
|
||||||
file:
|
file:
|
||||||
@@ -211,7 +211,7 @@ You can find the entire sample `pom.xml` file for deploying Spring Cloud Functio
|
|||||||
applications to AWS Lambda with Maven https://github.com/spring-cloud/spring-cloud-function/blob/{branch}/spring-cloud-function-samples/function-sample-aws/pom.xml[here].
|
applications to AWS Lambda with Maven https://github.com/spring-cloud/spring-cloud-function/blob/{branch}/spring-cloud-function-samples/function-sample-aws/pom.xml[here].
|
||||||
|
|
||||||
[[gradle]]
|
[[gradle]]
|
||||||
===== Gradle
|
=== Gradle
|
||||||
|
|
||||||
In order to use the adapter plugin for Gradle, add the dependency to your `build.gradle` file:
|
In order to use the adapter plugin for Gradle, add the dependency to your `build.gradle` file:
|
||||||
|
|
||||||
@@ -280,7 +280,7 @@ You can find the entire sample `build.gradle` file for deploying Spring Cloud Fu
|
|||||||
applications to AWS Lambda with Gradle https://github.com/spring-cloud/spring-cloud-function/blob/{branch}/spring-cloud-function-samples/function-sample-aws/build.gradle[here].
|
applications to AWS Lambda with Gradle https://github.com/spring-cloud/spring-cloud-function/blob/{branch}/spring-cloud-function-samples/function-sample-aws/build.gradle[here].
|
||||||
|
|
||||||
[[upload]]
|
[[upload]]
|
||||||
==== Upload
|
== Upload
|
||||||
|
|
||||||
Build the sample under `spring-cloud-function-samples/function-sample-aws` and upload the `-aws` jar file to Lambda. The handler can be `example.Handler` or `org.springframework.cloud.function.adapter.aws.SpringBootStreamHandler` (FQN of the class, _not_ a method reference, although Lambda does accept method references).
|
Build the sample under `spring-cloud-function-samples/function-sample-aws` and upload the `-aws` jar file to Lambda. The handler can be `example.Handler` or `org.springframework.cloud.function.adapter.aws.SpringBootStreamHandler` (FQN of the class, _not_ a method reference, although Lambda does accept method references).
|
||||||
|
|
||||||
@@ -306,7 +306,7 @@ NOTE: The AWS sample app is written in the "functional" style (as an `Applicatio
|
|||||||
|
|
||||||
|
|
||||||
[[type-conversion]]
|
[[type-conversion]]
|
||||||
==== Type Conversion
|
== Type Conversion
|
||||||
|
|
||||||
Spring Cloud Function will attempt to transparently handle type conversion between the raw
|
Spring Cloud Function will attempt to transparently handle type conversion between the raw
|
||||||
input stream and types declared by your function.
|
input stream and types declared by your function.
|
||||||
@@ -318,7 +318,7 @@ In the event type is not known or can not be determined (e.g., `Function<?, ?>`)
|
|||||||
convert an incoming stream event to a generic `Map`.
|
convert an incoming stream event to a generic `Map`.
|
||||||
|
|
||||||
[[raw-input]]
|
[[raw-input]]
|
||||||
====== Raw Input
|
==== Raw Input
|
||||||
|
|
||||||
There are times when you may want to have access to a raw input. In this case all you need is to declare your
|
There are times when you may want to have access to a raw input. In this case all you need is to declare your
|
||||||
function signature to accept `InputStream`. For example, `Function<InputStream, ?>`. In this case
|
function signature to accept `InputStream`. For example, `Function<InputStream, ?>`. In this case
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
The https://aws.amazon.com/[AWS] adapter takes a Spring Cloud Function app and converts it to a form that can run in AWS Lambda.
|
The https://aws.amazon.com/[AWS] adapter takes a Spring Cloud Function app and converts it to a form that can run in AWS Lambda.
|
||||||
|
|
||||||
[[introduction]]
|
[[introduction]]
|
||||||
== Introduction
|
= Introduction
|
||||||
|
|
||||||
include::adapters/aws-intro.adoc[]
|
include::adapters/aws-intro.adoc[]
|
||||||
|
|
||||||
[[functional-bean-definitions]]
|
[[functional-bean-definitions]]
|
||||||
== Functional Bean Definitions
|
= Functional Bean Definitions
|
||||||
|
|
||||||
Your functions will start much quicker if you can use functional bean definitions instead of `@Bean`. To do this make your main class
|
Your functions will start much quicker if you can use functional bean definitions instead of `@Bean`. To do this make your main class
|
||||||
an `ApplicationContextInitializer<GenericApplicationContext>` and use the `registerBean()` methods in `GenericApplicationContext` to
|
an `ApplicationContextInitializer<GenericApplicationContext>` and use the `registerBean()` methods in `GenericApplicationContext` to
|
||||||
@@ -40,7 +40,7 @@ public class FuncApplication implements ApplicationContextInitializer<GenericApp
|
|||||||
```
|
```
|
||||||
|
|
||||||
[[aws-context]]
|
[[aws-context]]
|
||||||
== AWS Context
|
= AWS Context
|
||||||
|
|
||||||
In a typical implementation of AWS Handler user has access to AWS _context_ object. With function approach you can have the same experience if you need it.
|
In a typical implementation of AWS Handler user has access to AWS _context_ object. With function approach you can have the same experience if you need it.
|
||||||
Upon each invocation the framework will add `aws-context` message header containing the AWS _context_ instance for that particular invocation. So if you need to access it
|
Upon each invocation the framework will add `aws-context` message header containing the AWS _context_ instance for that particular invocation. So if you need to access it
|
||||||
@@ -48,10 +48,10 @@ you can simply have `Message<YourPojo>` as an input parameter to your function a
|
|||||||
For convenience we provide AWSLambdaUtils.AWS_CONTEXT constant.
|
For convenience we provide AWSLambdaUtils.AWS_CONTEXT constant.
|
||||||
|
|
||||||
[[platform-specific-features]]
|
[[platform-specific-features]]
|
||||||
== Platform Specific Features
|
= Platform Specific Features
|
||||||
|
|
||||||
[[http-and-api-gateway]]
|
[[http-and-api-gateway]]
|
||||||
=== HTTP and API Gateway
|
== HTTP and API Gateway
|
||||||
|
|
||||||
AWS has some platform-specific data types, including batching of messages, which is much more efficient than processing each one individually. To make use of these types you can write a function that depends on those types. Or you can rely on Spring to extract the data from the AWS types and convert it to a Spring `Message`. To do this you tell AWS that the function is of a specific generic handler type (depending on the AWS service) and provide a bean of type `Function<Message<S>,Message<T>>`, where `S` and `T` are your business data types. If there is more than one bean of type `Function` you may also need to configure the Spring Boot property `function.name` to be the name of the target bean (e.g. use `FUNCTION_NAME` as an environment variable).
|
AWS has some platform-specific data types, including batching of messages, which is much more efficient than processing each one individually. To make use of these types you can write a function that depends on those types. Or you can rely on Spring to extract the data from the AWS types and convert it to a Spring `Message`. To do this you tell AWS that the function is of a specific generic handler type (depending on the AWS service) and provide a bean of type `Function<Message<S>,Message<T>>`, where `S` and `T` are your business data types. If there is more than one bean of type `Function` you may also need to configure the Spring Boot property `function.name` to be the name of the target bean (e.g. use `FUNCTION_NAME` as an environment variable).
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ The supported AWS services and generic handler types are listed below:
|
|||||||
For example, to deploy behind an API Gateway, use `--handler org.springframework.cloud.function.adapter.aws.SpringBootApiGatewayRequestHandler` in your AWS command line (in via the UI) and define a `@Bean` of type `Function<Message<Foo>,Message<Bar>>` where `Foo` and `Bar` are POJO types (the data will be marshalled and unmarshalled by AWS using Jackson).
|
For example, to deploy behind an API Gateway, use `--handler org.springframework.cloud.function.adapter.aws.SpringBootApiGatewayRequestHandler` in your AWS command line (in via the UI) and define a `@Bean` of type `Function<Message<Foo>,Message<Bar>>` where `Foo` and `Bar` are POJO types (the data will be marshalled and unmarshalled by AWS using Jackson).
|
||||||
|
|
||||||
[[custom-runtime]]
|
[[custom-runtime]]
|
||||||
== Custom Runtime
|
= Custom Runtime
|
||||||
|
|
||||||
You can also benefit from https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html[AWS Lambda custom runtime] feature of AWS Lambda
|
You can also benefit from https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html[AWS Lambda custom runtime] feature of AWS Lambda
|
||||||
and Spring Cloud Function provides all the necessary components to make it easy.
|
and Spring Cloud Function provides all the necessary components to make it easy.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
:branch: master
|
:branch: master
|
||||||
|
|
||||||
[[microsoft-azure-functions]]
|
[[microsoft-azure-functions]]
|
||||||
== Microsoft Azure Functions
|
= Microsoft Azure Functions
|
||||||
:sectnums:
|
:sectnums:
|
||||||
|
|
||||||
https://azure.microsoft.com[Azure] function adapter for deploying `Spring Cloud Function` applications as native Azure Java Functions.
|
https://azure.microsoft.com[Azure] function adapter for deploying `Spring Cloud Function` applications as native Azure Java Functions.
|
||||||
@@ -21,12 +21,12 @@ This adapter hides the Azure annotations complexity and uses the familiar https:
|
|||||||
For further information follow the <<azure.web.adapter,Azure Web Adapter>> section below.
|
For further information follow the <<azure.web.adapter,Azure Web Adapter>> section below.
|
||||||
|
|
||||||
[[azure-adapter]]
|
[[azure-adapter]]
|
||||||
== Azure Adapter
|
= Azure Adapter
|
||||||
|
|
||||||
Provides `Spring` & `Spring Cloud Function` integration for Azure Functions.
|
Provides `Spring` & `Spring Cloud Function` integration for Azure Functions.
|
||||||
|
|
||||||
[[dependencies]]
|
[[dependencies]]
|
||||||
=== Dependencies
|
== Dependencies
|
||||||
|
|
||||||
In order to enable the Azure Function integration add the azure adapter dependency to your `pom.xml` or `build.gradle`
|
In order to enable the Azure Function integration add the azure adapter dependency to your `pom.xml` or `build.gradle`
|
||||||
files:
|
files:
|
||||||
@@ -55,7 +55,7 @@ dependencies {
|
|||||||
NOTE: version `4.0.0+` is required. Having the adapter on the classpath activates the Azure Java Worker integration.
|
NOTE: version `4.0.0+` is required. Having the adapter on the classpath activates the Azure Java Worker integration.
|
||||||
|
|
||||||
[[azure.development.guidelines]]
|
[[azure.development.guidelines]]
|
||||||
=== Development Guidelines
|
== Development Guidelines
|
||||||
|
|
||||||
Use the `@Component` (or `@Service`) annotation to turn any exiting Azure Function class (e.g. with `@FunctionName` handlers) into a Spring component.
|
Use the `@Component` (or `@Service`) annotation to turn any exiting Azure Function class (e.g. with `@FunctionName` handlers) into a Spring component.
|
||||||
Then you can auto-wire the required dependencies (or the <<spring-cloud-function.adoc#function.catalog,Function Catalog>> for Spring Cloud Function composition) and use those inside the Azure function handlers.
|
Then you can auto-wire the required dependencies (or the <<spring-cloud-function.adoc#function.catalog,Function Catalog>> for Spring Cloud Function composition) and use those inside the Azure function handlers.
|
||||||
@@ -131,7 +131,7 @@ public class HttpTriggerDemoApplication {
|
|||||||
<2> Functions auto-wired and used in the Azure function handlers.
|
<2> Functions auto-wired and used in the Azure function handlers.
|
||||||
|
|
||||||
[[function-catalog]]
|
[[function-catalog]]
|
||||||
==== Function Catalog
|
=== Function Catalog
|
||||||
|
|
||||||
The Spring Cloud Function supports a range of type signatures for user-defined functions, while providing a consistent execution model.
|
The Spring Cloud Function supports a range of type signatures for user-defined functions, while providing a consistent execution model.
|
||||||
For this it uses the <<spring-cloud-function.adoc#function.catalog,Function Catalog>> to transform all user defined functions into a canonical representation.
|
For this it uses the <<spring-cloud-function.adoc#function.catalog,Function Catalog>> to transform all user defined functions into a canonical representation.
|
||||||
@@ -142,7 +142,7 @@ But those are treated as plain Java class instances, not as a canonical Spring C
|
|||||||
To leverage Spring Cloud Function and have access to the canonical function representations, you need to auto-wire the `FunctionCatalog` and use it in your handler, like the `functionCatalog` instance the `springCloudFunction()` handler above.
|
To leverage Spring Cloud Function and have access to the canonical function representations, you need to auto-wire the `FunctionCatalog` and use it in your handler, like the `functionCatalog` instance the `springCloudFunction()` handler above.
|
||||||
|
|
||||||
[[accessing-azure-executioncontext]]
|
[[accessing-azure-executioncontext]]
|
||||||
==== Accessing Azure ExecutionContext
|
=== Accessing Azure ExecutionContext
|
||||||
|
|
||||||
Some time there is a need to access the target execution context provided by the Azure runtime in the form of `com.microsoft.azure.functions.ExecutionContext`.
|
Some time there is a need to access the target execution context provided by the Azure runtime in the form of `com.microsoft.azure.functions.ExecutionContext`.
|
||||||
For example one of such needs is logging, so it can appear in the Azure console.
|
For example one of such needs is logging, so it can appear in the Azure console.
|
||||||
@@ -182,7 +182,7 @@ public Function<Message<String>, String> uppercase(JsonMapper mapper) {
|
|||||||
|
|
||||||
|
|
||||||
[[azure.configuration]]
|
[[azure.configuration]]
|
||||||
=== Configuration
|
== Configuration
|
||||||
|
|
||||||
To run your function applications on Microsoft Azure, you have to provide the necessary configurations, such as `function.json` and `host.json`, and adhere to the compulsory https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-java?tabs=bash%2Cconsumption#folder-structure[packaging format].
|
To run your function applications on Microsoft Azure, you have to provide the necessary configurations, such as `function.json` and `host.json`, and adhere to the compulsory https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-java?tabs=bash%2Cconsumption#folder-structure[packaging format].
|
||||||
|
|
||||||
@@ -192,7 +192,7 @@ IMPORTANT: The Azure https://learn.microsoft.com/en-us/azure/azure-functions/fun
|
|||||||
The <<disable.spring.boot.plugin,Disable Spring Boot Plugin>> section below explains how to handle this.
|
The <<disable.spring.boot.plugin,Disable Spring Boot Plugin>> section below explains how to handle this.
|
||||||
|
|
||||||
[[azure-maven/gradle-plugins]]
|
[[azure-maven/gradle-plugins]]
|
||||||
==== Azure Maven/Gradle Plugins
|
=== Azure Maven/Gradle Plugins
|
||||||
|
|
||||||
Azure provides https://github.com/microsoft/azure-maven-plugins/tree/develop/azure-functions-maven-plugin[Maven] and https://github.com/microsoft/azure-gradle-plugins/tree/master/azure-functions-gradle-plugin[Gradle] plugins to process the annotated classes, generate the necessary configurations and produce the expected package layout.
|
Azure provides https://github.com/microsoft/azure-maven-plugins/tree/develop/azure-functions-maven-plugin[Maven] and https://github.com/microsoft/azure-gradle-plugins/tree/master/azure-functions-gradle-plugin[Gradle] plugins to process the annotated classes, generate the necessary configurations and produce the expected package layout.
|
||||||
Plugins are used to set the platform, runtime and app-settings properties like this:
|
Plugins are used to set the platform, runtime and app-settings properties like this:
|
||||||
@@ -276,7 +276,7 @@ azurefunctions {
|
|||||||
More information about the runtime configurations: https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-java?tabs=bash%2Cconsumption#java-versions[Java Versions], https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-java?tabs=bash%2Cconsumption#specify-the-deployment-os[Deployment OS].
|
More information about the runtime configurations: https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-java?tabs=bash%2Cconsumption#java-versions[Java Versions], https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-java?tabs=bash%2Cconsumption#specify-the-deployment-os[Deployment OS].
|
||||||
|
|
||||||
[[disable.spring.boot.plugin]]
|
[[disable.spring.boot.plugin]]
|
||||||
==== Disable Spring Boot Plugin
|
=== Disable Spring Boot Plugin
|
||||||
|
|
||||||
Expectedly, the Azure Functions run inside the Azure execution runtime, not inside the SpringBoot runtime!
|
Expectedly, the Azure Functions run inside the Azure execution runtime, not inside the SpringBoot runtime!
|
||||||
Furthermore, Azure expects a specific packaging format, generated by the Azure Maven/Gradle plugins, that is not compatible with the default Spring Boot packaging.
|
Furthermore, Azure expects a specific packaging format, generated by the Azure Maven/Gradle plugins, that is not compatible with the default Spring Boot packaging.
|
||||||
@@ -298,7 +298,7 @@ You have to either disable the SpringBoot Maven/Gradle plugin or use the https:/
|
|||||||
----
|
----
|
||||||
|
|
||||||
[[star-class-configuration]]
|
[[star-class-configuration]]
|
||||||
==== Main-Class Configuration
|
=== Main-Class Configuration
|
||||||
|
|
||||||
Specify the `Main-Class`/`Start-Class` to point to your Spring application entry point, such as the <<HttpTriggerDemoApplication,HttpTriggerDemoApplication>> class in the example above.
|
Specify the `Main-Class`/`Start-Class` to point to your Spring application entry point, such as the <<HttpTriggerDemoApplication,HttpTriggerDemoApplication>> class in the example above.
|
||||||
|
|
||||||
@@ -334,7 +334,7 @@ For local runs, add the `MAIN_CLASS` variable to your `local.settings.json` file
|
|||||||
IMPORTANT: If the `MAIN_CLASS` variable is not set, the Azure adapter lookups the `MANIFEST/META-INFO` attributes from the jars found on the classpath and selects the first `Main-Class:` annotated with either a `@SpringBootApplication` or `@SpringBootConfiguration` annotation.
|
IMPORTANT: If the `MAIN_CLASS` variable is not set, the Azure adapter lookups the `MANIFEST/META-INFO` attributes from the jars found on the classpath and selects the first `Main-Class:` annotated with either a `@SpringBootApplication` or `@SpringBootConfiguration` annotation.
|
||||||
|
|
||||||
[[metadata-configuration]]
|
[[metadata-configuration]]
|
||||||
==== Metadata Configuration
|
=== Metadata Configuration
|
||||||
|
|
||||||
You can use a shared https://learn.microsoft.com/en-us/azure/azure-functions/functions-host-json[host.json] file to configure the function app.
|
You can use a shared https://learn.microsoft.com/en-us/azure/azure-functions/functions-host-json[host.json] file to configure the function app.
|
||||||
|
|
||||||
@@ -354,7 +354,7 @@ The host.json metadata file contains configuration options that affect all funct
|
|||||||
TIP: If the file is not in the project top folder you need to configure your plugins accordingly (like `hostJson` maven attribute).
|
TIP: If the file is not in the project top folder you need to configure your plugins accordingly (like `hostJson` maven attribute).
|
||||||
|
|
||||||
[[samples]]
|
[[samples]]
|
||||||
=== Samples
|
== Samples
|
||||||
|
|
||||||
Here is a list of various Spring Cloud Function Azure Adapter samples you can explore:
|
Here is a list of various Spring Cloud Function Azure Adapter samples you can explore:
|
||||||
|
|
||||||
@@ -365,7 +365,7 @@ Here is a list of various Spring Cloud Function Azure Adapter samples you can ex
|
|||||||
- https://github.com/spring-cloud/spring-cloud-function/tree/main/spring-cloud-function-samples/function-sample-azure-kafka-trigger[ Kafka Trigger & Output Binding (Maven)].
|
- https://github.com/spring-cloud/spring-cloud-function/tree/main/spring-cloud-function-samples/function-sample-azure-kafka-trigger[ Kafka Trigger & Output Binding (Maven)].
|
||||||
|
|
||||||
[[azure.web.adapter]]
|
[[azure.web.adapter]]
|
||||||
== Azure Web Adapter
|
= Azure Web Adapter
|
||||||
|
|
||||||
For, pure, Web-based function applications, you can replace the generic `adapter-azure` with the specialized https://github.com/spring-cloud/spring-cloud-function/tree/main/spring-cloud-function-adapters/spring-cloud-function-adapter-azure-web[spring-cloud-function-adapter-azure-web].
|
For, pure, Web-based function applications, you can replace the generic `adapter-azure` with the specialized https://github.com/spring-cloud/spring-cloud-function/tree/main/spring-cloud-function-adapters/spring-cloud-function-adapter-azure-web[spring-cloud-function-adapter-azure-web].
|
||||||
The Azure Web Adapter can deploy any Spring Web application as a native Azure function, using the HttpTrigger internally.
|
The Azure Web Adapter can deploy any Spring Web application as a native Azure function, using the HttpTrigger internally.
|
||||||
@@ -398,19 +398,19 @@ The same <<azure.configuration, Configuration>> and <<azure.usage,Usage>> instru
|
|||||||
|
|
||||||
|
|
||||||
[[samples]]
|
[[samples]]
|
||||||
=== Samples
|
== Samples
|
||||||
|
|
||||||
For further information, explore the following, Azure Web Adapter, sample:
|
For further information, explore the following, Azure Web Adapter, sample:
|
||||||
|
|
||||||
- https://github.com/spring-cloud/spring-cloud-function/tree/main/spring-cloud-function-samples/function-sample-azure-web[ Azure Web Adapter (Maven)].
|
- https://github.com/spring-cloud/spring-cloud-function/tree/main/spring-cloud-function-samples/function-sample-azure-web[ Azure Web Adapter (Maven)].
|
||||||
|
|
||||||
[[azure.usage]]
|
[[azure.usage]]
|
||||||
== Usage
|
= Usage
|
||||||
|
|
||||||
Common instructions for building and deploying both, `Azure Adapter` and `Azure Web Adapter` type of applications.
|
Common instructions for building and deploying both, `Azure Adapter` and `Azure Web Adapter` type of applications.
|
||||||
|
|
||||||
[[build]]
|
[[build]]
|
||||||
=== Build
|
== Build
|
||||||
|
|
||||||
====
|
====
|
||||||
[source,xml,indent=0,subs="verbatim,attributes",role="primary"]
|
[source,xml,indent=0,subs="verbatim,attributes",role="primary"]
|
||||||
@@ -427,7 +427,7 @@ Common instructions for building and deploying both, `Azure Adapter` and `Azure
|
|||||||
====
|
====
|
||||||
|
|
||||||
[[running-locally]]
|
[[running-locally]]
|
||||||
=== Running locally
|
== Running locally
|
||||||
|
|
||||||
To run locally on top of `Azure Functions`, and to deploy to your live Azure environment, you will need `Azure Functions Core Tools` installed along with the Azure CLI (see https://docs.microsoft.com/en-us/azure/azure-functions/create-first-function-cli-java?tabs=bash%2Cazure-cli%2Cbrowser#configure-your-local-environment[here]).
|
To run locally on top of `Azure Functions`, and to deploy to your live Azure environment, you will need `Azure Functions Core Tools` installed along with the Azure CLI (see https://docs.microsoft.com/en-us/azure/azure-functions/create-first-function-cli-java?tabs=bash%2Cazure-cli%2Cbrowser#configure-your-local-environment[here]).
|
||||||
For some configuration you would need the https://learn.microsoft.com/en-us/azure/storage/common/storage-use-emulator[Azurite emulator] as well.
|
For some configuration you would need the https://learn.microsoft.com/en-us/azure/storage/common/storage-use-emulator[Azurite emulator] as well.
|
||||||
@@ -449,7 +449,7 @@ Then run the sample:
|
|||||||
====
|
====
|
||||||
|
|
||||||
[[running-on-azure]]
|
[[running-on-azure]]
|
||||||
=== Running on Azure
|
== Running on Azure
|
||||||
|
|
||||||
Make sure you are logged in your Azure account.
|
Make sure you are logged in your Azure account.
|
||||||
|
|
||||||
@@ -474,7 +474,7 @@ and deploy
|
|||||||
====
|
====
|
||||||
|
|
||||||
[[debug-locally]]
|
[[debug-locally]]
|
||||||
=== Debug locally
|
== Debug locally
|
||||||
|
|
||||||
Run the function in debug mode.
|
Run the function in debug mode.
|
||||||
|
|
||||||
@@ -530,14 +530,14 @@ Here is snippet for a `VSCode` remote debugging configuration:
|
|||||||
----
|
----
|
||||||
|
|
||||||
[[functioninvoker-deprecated]]
|
[[functioninvoker-deprecated]]
|
||||||
== FunctionInvoker (deprecated)
|
= FunctionInvoker (deprecated)
|
||||||
|
|
||||||
WARNING: The legacy `FunctionInvoker` programming model is deprecated and will not be supported going forward.
|
WARNING: The legacy `FunctionInvoker` programming model is deprecated and will not be supported going forward.
|
||||||
|
|
||||||
For additional documentation and samples about the Function Integration approach follow the https://github.com/spring-cloud/spring-cloud-function/tree/main/spring-cloud-function-samples/function-sample-azure/[azure-sample] README and code.
|
For additional documentation and samples about the Function Integration approach follow the https://github.com/spring-cloud/spring-cloud-function/tree/main/spring-cloud-function-samples/function-sample-azure/[azure-sample] README and code.
|
||||||
|
|
||||||
[[relevant-links]]
|
[[relevant-links]]
|
||||||
== Relevant Links
|
= Relevant Links
|
||||||
|
|
||||||
- https://learn.microsoft.com/en-us/azure/developer/java/spring-framework/getting-started-with-spring-cloud-function-in-azure[Spring Cloud Function in Azure]
|
- https://learn.microsoft.com/en-us/azure/developer/java/spring-framework/getting-started-with-spring-cloud-function-in-azure[Spring Cloud Function in Azure]
|
||||||
- https://spring.io/blog/2023/02/24/spring-cloud-function-for-azure-function[Spring Cloud Function for Azure Function (blog)]
|
- https://spring.io/blog/2023/02/24/spring-cloud-function-for-azure-function[Spring Cloud Function for Azure Function (blog)]
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
:branch: master
|
:branch: master
|
||||||
|
|
||||||
[[google-cloud-functions]]
|
[[google-cloud-functions]]
|
||||||
=== Google Cloud Functions
|
= Google Cloud Functions
|
||||||
|
|
||||||
The Google Cloud Functions adapter enables Spring Cloud Function apps to run on the https://cloud.google.com/functions[Google Cloud Functions] serverless platform.
|
The Google Cloud Functions adapter enables Spring Cloud Function apps to run on the https://cloud.google.com/functions[Google Cloud Functions] serverless platform.
|
||||||
You can either run the function locally using the open source https://github.com/GoogleCloudPlatform/functions-framework-java[Google Functions Framework for Java] or on GCP.
|
You can either run the function locally using the open source https://github.com/GoogleCloudPlatform/functions-framework-java[Google Functions Framework for Java] or on GCP.
|
||||||
|
|
||||||
[[project-dependencies]]
|
[[project-dependencies]]
|
||||||
==== Project Dependencies
|
== Project Dependencies
|
||||||
|
|
||||||
Start by adding the `spring-cloud-function-adapter-gcp` dependency to your project.
|
Start by adding the `spring-cloud-function-adapter-gcp` dependency to your project.
|
||||||
|
|
||||||
@@ -65,12 +65,12 @@ NOTE: The function target should always be set to `org.springframework.cloud.fun
|
|||||||
A full example of a working `pom.xml` can be found in the https://github.com/spring-cloud/spring-cloud-function/blob/master/spring-cloud-function-samples/function-sample-gcp-http/pom.xml[Spring Cloud Functions GCP sample].
|
A full example of a working `pom.xml` can be found in the https://github.com/spring-cloud/spring-cloud-function/blob/master/spring-cloud-function-samples/function-sample-gcp-http/pom.xml[Spring Cloud Functions GCP sample].
|
||||||
|
|
||||||
[[http-functions]]
|
[[http-functions]]
|
||||||
==== HTTP Functions
|
== HTTP Functions
|
||||||
|
|
||||||
Google Cloud Functions supports deploying https://cloud.google.com/functions/docs/writing/http[HTTP Functions], which are functions that are invoked by HTTP request. The sections below describe instructions for deploying a Spring Cloud Function as an HTTP Function.
|
Google Cloud Functions supports deploying https://cloud.google.com/functions/docs/writing/http[HTTP Functions], which are functions that are invoked by HTTP request. The sections below describe instructions for deploying a Spring Cloud Function as an HTTP Function.
|
||||||
|
|
||||||
[[getting-started]]
|
[[getting-started]]
|
||||||
===== Getting Started
|
=== Getting Started
|
||||||
|
|
||||||
Let’s start with a simple Spring Cloud Function example:
|
Let’s start with a simple Spring Cloud Function example:
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ curl http://localhost:8080/ -d "hello"
|
|||||||
----
|
----
|
||||||
|
|
||||||
[[deploy-to-gcp]]
|
[[deploy-to-gcp]]
|
||||||
===== Deploy to GCP
|
=== Deploy to GCP
|
||||||
|
|
||||||
Start by packaging your application.
|
Start by packaging your application.
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ public Function<String, Message<String>> function() {
|
|||||||
|
|
||||||
|
|
||||||
[[background-functions]]
|
[[background-functions]]
|
||||||
==== Background Functions
|
== Background Functions
|
||||||
|
|
||||||
Google Cloud Functions also supports deploying https://cloud.google.com/functions/docs/writing/background[Background Functions] which are invoked indirectly in response to an event, such as a message on a https://cloud.google.com/pubsub[Cloud Pub/Sub] topic, a change in a https://cloud.google.com/storage[Cloud Storage] bucket, or a https://firebase.google.com/[Firebase] event.
|
Google Cloud Functions also supports deploying https://cloud.google.com/functions/docs/writing/background[Background Functions] which are invoked indirectly in response to an event, such as a message on a https://cloud.google.com/pubsub[Cloud Pub/Sub] topic, a change in a https://cloud.google.com/storage[Cloud Storage] bucket, or a https://firebase.google.com/[Firebase] event.
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@ The sections below describe the process for writing a Cloud Pub/Sub topic backgr
|
|||||||
However, there are a number of different event types that can trigger a background function to execute which are not discussed here; these are described in the https://cloud.google.com/functions/docs/calling[Background Function triggers documentation].
|
However, there are a number of different event types that can trigger a background function to execute which are not discussed here; these are described in the https://cloud.google.com/functions/docs/calling[Background Function triggers documentation].
|
||||||
|
|
||||||
[[getting-started]]
|
[[getting-started]]
|
||||||
===== Getting Started
|
=== Getting Started
|
||||||
|
|
||||||
Let’s start with a simple Spring Cloud Function which will run as a GCF background function:
|
Let’s start with a simple Spring Cloud Function which will run as a GCF background function:
|
||||||
|
|
||||||
@@ -267,7 +267,7 @@ curl localhost:8080 -H "Content-Type: application/json" -d '{"data":"hello"}'
|
|||||||
Verify that the function was invoked by viewing the logs.
|
Verify that the function was invoked by viewing the logs.
|
||||||
|
|
||||||
[[deploy-to-gcp]]
|
[[deploy-to-gcp]]
|
||||||
===== Deploy to GCP
|
=== Deploy to GCP
|
||||||
|
|
||||||
In order to deploy your background function to GCP, first package your application.
|
In order to deploy your background function to GCP, first package your application.
|
||||||
|
|
||||||
@@ -296,7 +296,7 @@ Google Cloud Function will now invoke the function every time a message is publi
|
|||||||
For a walkthrough on testing and verifying your background function, see the instructions for running the https://github.com/spring-cloud/spring-cloud-function/tree/master/spring-cloud-function-samples/function-sample-gcp-background/[GCF Background Function sample].
|
For a walkthrough on testing and verifying your background function, see the instructions for running the https://github.com/spring-cloud/spring-cloud-function/tree/master/spring-cloud-function-samples/function-sample-gcp-background/[GCF Background Function sample].
|
||||||
|
|
||||||
[[sample-functions]]
|
[[sample-functions]]
|
||||||
==== Sample Functions
|
== Sample Functions
|
||||||
|
|
||||||
The project provides the following sample functions as reference:
|
The project provides the following sample functions as reference:
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
Spring Cloud Function supports a "functional" style of bean declarations for small apps where you need fast startup. The functional style of bean declaration was a feature of Spring Framework 5.0 with significant enhancements in 5.1.
|
Spring Cloud Function supports a "functional" style of bean declarations for small apps where you need fast startup. The functional style of bean declaration was a feature of Spring Framework 5.0 with significant enhancements in 5.1.
|
||||||
|
|
||||||
[[comparing-functional-with-traditional-bean-definitions]]
|
[[comparing-functional-with-traditional-bean-definitions]]
|
||||||
== Comparing Functional with Traditional Bean Definitions
|
= Comparing Functional with Traditional Bean Definitions
|
||||||
|
|
||||||
Here's a vanilla Spring Cloud Function application from with the
|
Here's a vanilla Spring Cloud Function application from with the
|
||||||
familiar `@Configuration` and `@Bean` declaration style:
|
familiar `@Configuration` and `@Bean` declaration style:
|
||||||
@@ -115,7 +115,7 @@ public void initialize(GenericApplicationContext context) {
|
|||||||
----
|
----
|
||||||
|
|
||||||
[[limitations-of-functional-bean-declaration]]
|
[[limitations-of-functional-bean-declaration]]
|
||||||
== Limitations of Functional Bean Declaration
|
= Limitations of Functional Bean Declaration
|
||||||
|
|
||||||
Most Spring Cloud Function apps have a relatively small scope compared to the whole of Spring Boot,
|
Most Spring Cloud Function apps have a relatively small scope compared to the whole of Spring Boot,
|
||||||
so we are able to adapt it to these functional bean definitions easily. If you step outside that limited scope,
|
so we are able to adapt it to these functional bean definitions easily. If you step outside that limited scope,
|
||||||
@@ -131,7 +131,7 @@ functional mode" using `spring.functional.enabled=false` so that Spring Boot can
|
|||||||
Spring Cloud Function supports visualization of functions available in `FunctionCatalog` through Actuator endpoints as well as programmatic way.
|
Spring Cloud Function supports visualization of functions available in `FunctionCatalog` through Actuator endpoints as well as programmatic way.
|
||||||
|
|
||||||
[[programmatic-way]]
|
[[programmatic-way]]
|
||||||
==== Programmatic way
|
=== Programmatic way
|
||||||
|
|
||||||
To see function available within your application context programmatically all you need is access to `FunctionCatalog`. There you can
|
To see function available within your application context programmatically all you need is access to `FunctionCatalog`. There you can
|
||||||
finds methods to get the size of the catalog, lookup functions as well as list the names of all the available functions.
|
finds methods to get the size of the catalog, lookup functions as well as list the names of all the available functions.
|
||||||
@@ -147,7 +147,7 @@ Set<String> names = functionCatalog.getNames(null); will list the names of all t
|
|||||||
----
|
----
|
||||||
|
|
||||||
[[actuator]]
|
[[actuator]]
|
||||||
==== Actuator
|
=== Actuator
|
||||||
Since actuator and web are optional, you must first add one of the web dependencies as well as add the actuator dependency manually.
|
Since actuator and web are optional, you must first add one of the web dependencies as well as add the actuator dependency manually.
|
||||||
The following example shows how to add the dependency for the Web framework:
|
The following example shows how to add the dependency for the Web framework:
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[[spring-integration]]
|
[[spring-integration]]
|
||||||
== Spring Integration Interaction
|
= Spring Integration Interaction
|
||||||
|
|
||||||
https://spring.io/projects/spring-integration[Spring Integration Framework] extends the Spring programming model to support the well-known Enterprise Integration Patterns.
|
https://spring.io/projects/spring-integration[Spring Integration Framework] extends the Spring programming model to support the well-known Enterprise Integration Patterns.
|
||||||
It enables lightweight messaging within Spring-based applications and supports integration with external systems via declarative adapters.
|
It enables lightweight messaging within Spring-based applications and supports integration with external systems via declarative adapters.
|
||||||
|
|||||||
Reference in New Issue
Block a user