First round of antora migration
This commit is contained in:
@@ -1,20 +1,15 @@
|
||||
* xref:spring-cloud-function/introduction.adoc[]
|
||||
* xref:index.adoc[]
|
||||
* xref:spring-integration.adoc[]
|
||||
* xref:_intro.adoc[]
|
||||
** xref:adapters/aws-intro.adoc[]
|
||||
** xref:adapters/aws.adoc[]
|
||||
** xref:adapters/azure-intro.adoc[]
|
||||
** xref:adapters/azure.adoc[]
|
||||
** xref:adapters/gcp-intro.adoc[]
|
||||
** xref:adapters/gcp.adoc[]
|
||||
* xref:functional.adoc[]
|
||||
* xref:getting-started.adoc[]
|
||||
* xref:spring-cloud-function.adoc[]
|
||||
** xref:spring-cloud-function/introduction.adoc[]
|
||||
** xref:spring-cloud-function/getting-started.adoc[]
|
||||
** xref:spring-cloud-function/programming-model.adoc[]
|
||||
** xref:spring-cloud-function/standalone-web-applications.adoc[]
|
||||
** xref:spring-cloud-function/standalone-streaming-applications.adoc[]
|
||||
** xref:spring-cloud-function/deploying-a-packaged.adoc[]
|
||||
** xref:spring-cloud-function/functional-bean-definitions.adoc[]
|
||||
** xref:functional.adoc[]
|
||||
** xref:spring-cloud-function/serverless-platform-adapters.adoc[]
|
||||
*** xref:adapters/aws-intro.adoc[]
|
||||
*** xref:adapters/azure-intro.adoc[]
|
||||
*** xref:adapters/gcp-intro.adoc[]
|
||||
** xref:spring-cloud-function/apendix.adoc[]
|
||||
*** https://github.com/spring-cloud/spring-cloud-function/tree/main/spring-cloud-function-samples/function-sample-cloudevent[Cloud Events support]
|
||||
*** https://github.com/spring-cloud/spring-cloud-function/tree/main/spring-cloud-function-rsocket[RSocket support]
|
||||
*** xref:spring-integration.adoc[Spring Integration]
|
||||
@@ -1,5 +1,3 @@
|
||||
:branch: master
|
||||
|
||||
[[aws-lambda]]
|
||||
= AWS Lambda
|
||||
|
||||
@@ -48,7 +46,7 @@ Then you have to upload the JAR file (via AWS dashboard or AWS CLI) to AWS.
|
||||
|
||||
When ask about _handler_ you specify `org.springframework.cloud.function.adapter.aws.FunctionInvoker::handleRequest` which is a generic request handler.
|
||||
|
||||
image::{github-raw}/docs/src/main/asciidoc/images/AWS-deploy.png[width=800,scaledwidth="75%",align="center"]
|
||||
image::AWS-deploy.png[width=800,scaledwidth="75%",align="center"]
|
||||
|
||||
That is all. Save and execute the function with some sample data which for this function is expected to be a
|
||||
String which function will uppercase and return back.
|
||||
@@ -59,10 +57,10 @@ to use. The next section will explain you how you can accomplish just that.
|
||||
|
||||
|
||||
[[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)
|
||||
is `org.springframework.cloud.function.adapter.aws.FunctionInvoker` which is the implementation of AWS's `RequestStreamHandler`.
|
||||
While AWS Lambda allows you to implement various `RequestHandlers`, with Spring Cloud Function you don't need to implement any, and instead use the provided
|
||||
`org.springframework.cloud.function.adapter.aws.FunctionInvoker` which is the implementation of AWS's `RequestStreamHandler`.
|
||||
User doesn't need to do anything other then specify it as 'handler' on AWS dashboard when deploying function.
|
||||
It will handle most of the case including Kinesis, streaming etc. .
|
||||
|
||||
@@ -71,9 +69,28 @@ If your app has more than one `@Bean` of type `Function` etc. then you can choos
|
||||
property or environment variable. The functions are extracted from the Spring Cloud `FunctionCatalog`. In the event you don't specify `spring.cloud.function.definition`
|
||||
the framework will attempt to find a default following the search order where it searches first for `Function` then `Consumer` and finally `Supplier`).
|
||||
|
||||
[[type-conversion]]
|
||||
=== Type Conversion
|
||||
|
||||
Spring Cloud Function will attempt to transparently handle type conversion between the raw
|
||||
input stream and types declared by your function.
|
||||
|
||||
For example, if your function signature is as such `Function<Foo, Bar>` we will attempt to convert
|
||||
incoming stream event to an instance of `Foo`.
|
||||
|
||||
In the event type is not known or can not be determined (e.g., `Function<?, ?>`) we will attempt to
|
||||
convert an incoming stream event to a generic `Map`.
|
||||
|
||||
[[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
|
||||
function signature to accept `InputStream`. For example, `Function<InputStream, ?>`. In this case
|
||||
we will not attempt any conversion and will pass the raw input directly to a function.
|
||||
|
||||
|
||||
[[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]
|
||||
- an ability to have one special function to delegate to other functions based on the user provided routing instructions.
|
||||
@@ -94,6 +111,40 @@ Also, note that since AWS does not allow dots `.` and/or hyphens`-` in the name
|
||||
dots with underscores and hyphens with camel case. So for example `spring.cloud.function.definition` becomes `spring_cloud_function_definition`
|
||||
and `spring.cloud.function.routing-expression` becomes `spring_cloud_function_routingExpression`.
|
||||
|
||||
[[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
|
||||
and Spring Cloud Function provides all the necessary components to make it easy.
|
||||
|
||||
From the code perspective the application should look no different then any other Spring Cloud Function application.
|
||||
The only thing you need to do is to provide a `bootstrap` script in the root of your zip/jar that runs the Spring Boot application.
|
||||
and select "Custom Runtime" when creating a function in AWS.
|
||||
Here is an example 'bootstrap' file:
|
||||
```text
|
||||
#!/bin/sh
|
||||
|
||||
cd ${LAMBDA_TASK_ROOT:-.}
|
||||
|
||||
java -Dspring.main.web-application-type=none -Dspring.jmx.enabled=false \
|
||||
-noverify -XX:TieredStopAtLevel=1 -Xss256K -XX:MaxMetaspaceSize=128M \
|
||||
-Djava.security.egd=file:/dev/./urandom \
|
||||
-cp .:`echo lib/*.jar | tr ' ' :` com.example.LambdaApplication
|
||||
```
|
||||
The `com.example.LambdaApplication` represents your application which contains function beans.
|
||||
|
||||
Set the handler name in AWS to the name of your function. You can use function composition here as well (e.g., `uppecrase|reverse`).
|
||||
That is pretty much all. Once you upload your zip/jar to AWS your function will run in custom runtime.
|
||||
We provide a https://github.com/spring-cloud/spring-cloud-function/tree/master/spring-cloud-function-samples/function-sample-aws-custom-new[sample project]
|
||||
where you can also see how to configure yoru POM to properly generate the zip file.
|
||||
|
||||
The functional bean definition style works for custom runtimes as well, and is
|
||||
faster than the `@Bean` style. A custom runtime can start up much quicker even than a functional bean implementation
|
||||
of a Java lambda - it depends mostly on the number of classes you need to load at runtime.
|
||||
Spring doesn't do very much here, so you can reduce the cold start time by only using primitive types in your function, for instance,
|
||||
and not doing any work in custom `@PostConstruct` initializers.
|
||||
|
||||
|
||||
[[aws-function-routing-with-custom-runtime]]
|
||||
=== AWS Function Routing with Custom Runtime
|
||||
|
||||
@@ -278,53 +329,3 @@ assemble.dependsOn = [thinJar]
|
||||
|
||||
You can find the entire sample `build.gradle` file for deploying Spring Cloud Function
|
||||
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
|
||||
|
||||
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).
|
||||
|
||||
----
|
||||
./mvnw -U clean package
|
||||
----
|
||||
|
||||
Using the AWS command line tools it looks like this:
|
||||
|
||||
----
|
||||
aws lambda create-function --function-name Uppercase --role arn:aws:iam::[USERID]:role/service-role/[ROLE] --zip-file fileb://function-sample-aws/target/function-sample-aws-2.0.0.BUILD-SNAPSHOT-aws.jar --handler org.springframework.cloud.function.adapter.aws.SpringBootStreamHandler --description "Spring Cloud Function Adapter Example" --runtime java8 --region us-east-1 --timeout 30 --memory-size 1024 --publish
|
||||
----
|
||||
|
||||
The input type for the function in the AWS sample is a Foo with a single property called "value". So you would need this to test it:
|
||||
|
||||
----
|
||||
{
|
||||
"value": "test"
|
||||
}
|
||||
----
|
||||
|
||||
NOTE: The AWS sample app is written in the "functional" style (as an `ApplicationContextInitializer`). This is much faster on startup in Lambda than the traditional `@Bean` style, so if you don't need `@Beans` (or `@EnableAutoConfiguration`) it's a good choice. Warm starts are not affected.
|
||||
|
||||
|
||||
[[type-conversion]]
|
||||
== Type Conversion
|
||||
|
||||
Spring Cloud Function will attempt to transparently handle type conversion between the raw
|
||||
input stream and types declared by your function.
|
||||
|
||||
For example, if your function signature is as such `Function<Foo, Bar>` we will attempt to convert
|
||||
incoming stream event to an instance of `Foo`.
|
||||
|
||||
In the event type is not known or can not be determined (e.g., `Function<?, ?>`) we will attempt to
|
||||
convert an incoming stream event to a generic `Map`.
|
||||
|
||||
[[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
|
||||
function signature to accept `InputStream`. For example, `Function<InputStream, ?>`. In this case
|
||||
we will not attempt any conversion and will pass the raw input directly to a function.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,50 +4,105 @@
|
||||
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
|
||||
|
||||
The details of how to get stared with AWS Lambda is out of scope of this document, so the expectation is that user has some familiarity with
|
||||
AWS and AWS Lambda and wants to learn what additional value spring provides.
|
||||
|
||||
|
||||
[[functional-bean-definitions]]
|
||||
= Functional Bean Definitions
|
||||
=== Getting Started
|
||||
|
||||
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
|
||||
create all the beans you need. You function need to be registered as a bean of type `FunctionRegistration` so that the input and
|
||||
output types can be accessed by the framework. There is an example in github (the AWS sample is written in this style). It would
|
||||
look something like this:
|
||||
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.
|
||||
A simple function application (in context or Spring) is an application that contains beans of type Supplier, Function or Consumer.
|
||||
So, with AWS it means that a simple function bean should somehow be recognised and executed in AWS Lambda environment.
|
||||
|
||||
```java
|
||||
@SpringBootConfiguration
|
||||
public class FuncApplication implements ApplicationContextInitializer<GenericApplicationContext> {
|
||||
Let’s look at the example:
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FunctionalSpringApplication.run(FuncApplication.class, args);
|
||||
[source, java]
|
||||
----
|
||||
@SpringBootApplication
|
||||
public class FunctionConfiguration {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(FunctionConfiguration.class, args);
|
||||
}
|
||||
|
||||
public Function<Foo, Bar> function() {
|
||||
return value -> new Bar(value.uppercase()));
|
||||
@Bean
|
||||
public Function<String, String> uppercase() {
|
||||
return value -> value.toUpperCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(GenericApplicationContext context) {
|
||||
context.registerBean("function", FunctionRegistration.class,
|
||||
() -> new FunctionRegistration<Function<Foo, Bar>>(function())
|
||||
.type(FunctionTypeUtils.functionType(Foo.class, Bar.class)));
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
----
|
||||
|
||||
It shows a complete Spring Boot application with a function bean defined in it. What’s interesting is that on the surface this is just
|
||||
another boot app, but in the context of AWS Adapter it is also a perfectly valid AWS Lambda application. No other code or configuration
|
||||
is required. All you need to do is package it and deploy it, so let’s look how we can do that.
|
||||
|
||||
To make things simpler we’ve provided a sample project ready to be built and deployed and you can access it
|
||||
https://github.com/spring-cloud/spring-cloud-function/tree/master/spring-cloud-function-samples/function-sample-aws[here].
|
||||
|
||||
You simply execute `./mvnw clean package` to generate JAR file. All the necessary maven plugins have already been setup to generate
|
||||
appropriate AWS deployable JAR file. (You can read more details about JAR layout in <<Notes on JAR Layout>>).
|
||||
|
||||
Then you have to upload the JAR file (via AWS dashboard or AWS CLI) to AWS.
|
||||
|
||||
When ask about _handler_ you specify `org.springframework.cloud.function.adapter.aws.FunctionInvoker::handleRequest` which is a generic request handler.
|
||||
|
||||
image::AWS-deploy.png[width=800,scaledwidth="75%",align="center"]
|
||||
|
||||
That is all. Save and execute the function with some sample data which for this function is expected to be a
|
||||
String which function will uppercase and return back.
|
||||
|
||||
While `org.springframework.cloud.function.adapter.aws.FunctionInvoker` is a general purpose AWS's `RequestHandler` implementation aimed at completely
|
||||
isolating you from the specifics of AWS Lambda API, for some cases you may want to specify which specific AWS's `RequestHandler` you want
|
||||
to use. The next section will explain you how you can accomplish just that.
|
||||
|
||||
|
||||
[[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)
|
||||
is `org.springframework.cloud.function.adapter.aws.FunctionInvoker` which is the implementation of AWS's `RequestStreamHandler`.
|
||||
User doesn't need to do anything other then specify it as 'handler' on AWS dashboard when deploying function.
|
||||
It will handle most of the case including Kinesis, streaming etc. .
|
||||
|
||||
|
||||
If your app has more than one `@Bean` of type `Function` etc. then you can choose the one to use by configuring `spring.cloud.function.definition`
|
||||
property or environment variable. The functions are extracted from the Spring Cloud `FunctionCatalog`. In the event you don't specify `spring.cloud.function.definition`
|
||||
the framework will attempt to find a default following the search order where it searches first for `Function` then `Consumer` and finally `Supplier`).
|
||||
|
||||
[[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.
|
||||
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
|
||||
you can simply have `Message<YourPojo>` as an input parameter to your function and then access `aws-context` from message headers.
|
||||
For convenience we provide AWSLambdaUtils.AWS_CONTEXT constant.
|
||||
|
||||
[[platform-specific-features]]
|
||||
= Platform Specific Features
|
||||
|
||||
[[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]
|
||||
- an ability to have one special function to delegate to other functions based on the user provided routing instructions.
|
||||
|
||||
In AWS Lambda environment this feature provides one additional benefit, as it allows you to bind a single function (Routing Function)
|
||||
as AWS Lambda and thus a single HTTP endpoint for API Gateway. So in the end you only manage one function and one endpoint, while benefiting
|
||||
from many function that can be part of your application.
|
||||
|
||||
More details are available in the provided https://github.com/spring-cloud/spring-cloud-function/tree/main/spring-cloud-function-samples/function-sample-aws-routing[sample],
|
||||
yet few general things worth mentioning.
|
||||
|
||||
Routing capabilities will be enabled by default whenever there is more then one function in your application as `org.springframework.cloud.function.adapter.aws.FunctionInvoker`
|
||||
can not determine which function to bind as AWS Lambda, so it defaults to `RoutingFunction`.
|
||||
This means that all you need to do is provide routing instructions which you can do https://docs.spring.io/spring-cloud-function/docs/{project-version}/reference/html/spring-cloud-function.html#_function_routing_and_filtering[using several mechanisms]
|
||||
(see https://github.com/spring-cloud/spring-cloud-function/tree/main/spring-cloud-function-samples/function-sample-aws-routing[sample] for more details).
|
||||
|
||||
Also, note that since AWS does not allow dots `.` and/or hyphens`-` in the name of the environment variable, you can benefit from boot support and simply substitute
|
||||
dots with underscores and hyphens with camel case. So for example `spring.cloud.function.definition` becomes `spring_cloud_function_definition`
|
||||
and `spring.cloud.function.routing-expression` becomes `spring_cloud_function_routingExpression`.
|
||||
|
||||
|
||||
[[http-and-api-gateway]]
|
||||
== HTTP and API Gateway
|
||||
@@ -67,7 +122,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).
|
||||
|
||||
[[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
|
||||
and Spring Cloud Function provides all the necessary components to make it easy.
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
:branch: master
|
||||
|
||||
[[microsoft-azure-functions]]
|
||||
= Microsoft Azure Functions
|
||||
:sectnums:
|
||||
|
||||
|
||||
https://azure.microsoft.com[Azure] function adapter for deploying `Spring Cloud Function` applications as native Azure Java Functions.
|
||||
|
||||
@@ -13,7 +11,7 @@ The Azure annotations are just a type-safe way to configure your java function t
|
||||
The https://github.com/spring-cloud/spring-cloud-function/tree/main/spring-cloud-function-adapters/spring-cloud-function-adapter-azure[spring-cloud-function-adapter-azure] extends the basic programming model to provide Spring and Spring Cloud Function support.
|
||||
With the adapter you can build your Spring Cloud Function application using dependency injections and then auto-wire the necessary services into your Azure handler methods.
|
||||
|
||||
image::../images/scf-azure-adapter.svg[width=800,scaledwidth="75%",align="center"]
|
||||
image::{github-raw}/docs/src/main/asciidoc/images/scf-azure-adapter.svg[width=800,scaledwidth="75%",align="center"]
|
||||
|
||||
TIP: For 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].
|
||||
With the Azure Web Adapter you can deploy any Spring Web application as an Azure, HttpTrigger, function.
|
||||
@@ -21,12 +19,12 @@ This adapter hides the Azure annotations complexity and uses the familiar https:
|
||||
For further information follow the xref:adapters/azure-intro.adoc#azure.web.adapter[Azure Web Adapter] section below.
|
||||
|
||||
[[azure-adapter]]
|
||||
= Azure Adapter
|
||||
== Azure Adapter
|
||||
|
||||
Provides `Spring` & `Spring Cloud Function` integration for Azure Functions.
|
||||
|
||||
[[dependencies]]
|
||||
== Dependencies
|
||||
=== Dependencies
|
||||
|
||||
In order to enable the Azure Function integration add the azure adapter dependency to your `pom.xml` or `build.gradle`
|
||||
files:
|
||||
@@ -58,7 +56,7 @@ dependencies {
|
||||
NOTE: version `4.0.0+` is required. Having the adapter on the classpath activates the Azure Java Worker integration.
|
||||
|
||||
[[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.
|
||||
Then you can auto-wire the required dependencies (or the xref:spring-cloud-function/programming-model.adoc#function.catalog[Function Catalog] for Spring Cloud Function composition) and use those inside the Azure function handlers.
|
||||
@@ -409,8 +407,7 @@ dependencies {
|
||||
The same xref:adapters/azure-intro.adoc#azure.configuration[Configuration] and xref:adapters/azure-intro.adoc#azure.usage[Usage] instructions apply to the `Azure Web Adapter` as well.
|
||||
|
||||
|
||||
[[samples]]
|
||||
== Samples
|
||||
== Azure Samples
|
||||
|
||||
For further information, explore the following, Azure Web Adapter, sample:
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
:branch: master
|
||||
|
||||
[[google-cloud-functions]]
|
||||
= Google Cloud Functions
|
||||
|
||||
@@ -7,7 +5,7 @@ The Google Cloud Functions adapter enables Spring Cloud Function apps to run on
|
||||
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
|
||||
|
||||
Start by adding the `spring-cloud-function-adapter-gcp` dependency to your project.
|
||||
|
||||
@@ -65,7 +63,7 @@ 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].
|
||||
|
||||
[[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.
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
= Functional Bean Definitions
|
||||
|
||||
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
|
||||
|
||||
Here's a vanilla Spring Cloud Function application from with the
|
||||
familiar `@Configuration` and `@Bean` declaration style:
|
||||
@@ -115,7 +116,7 @@ public void initialize(GenericApplicationContext context) {
|
||||
----
|
||||
|
||||
[[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,
|
||||
so we are able to adapt it to these functional bean definitions easily. If you step outside that limited scope,
|
||||
@@ -126,7 +127,7 @@ declarations if you want (i.e. the "hybrid" style), but in that case you will ne
|
||||
functional mode" using `spring.functional.enabled=false` so that Spring Boot can take back control.
|
||||
|
||||
[[function_visualization]]
|
||||
= Function visualization and control
|
||||
== Function visualization and control
|
||||
|
||||
Spring Cloud Function supports visualization of functions available in `FunctionCatalog` through Actuator endpoints as well as programmatic way.
|
||||
|
||||
@@ -203,7 +204,7 @@ Your output should look something like this:
|
||||
----
|
||||
|
||||
[[testing-functional-applications]]
|
||||
= Testing Functional Applications
|
||||
== Testing Functional Applications
|
||||
|
||||
Spring Cloud Function also has some utilities for integration testing that will be very familiar to Spring Boot users.
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
= Getting Started
|
||||
|
||||
Build from the command line (and "install" the samples):
|
||||
|
||||
----
|
||||
|
||||
@@ -1,25 +1,8 @@
|
||||
[[spring-cloud-function-reference-documentation]]
|
||||
= Spring Cloud Function Reference Documentation
|
||||
:page-section-summary-toc: 1
|
||||
|
||||
Mark Fisher, Dave Syer, Oleg Zhurakousky, Anshul Mehra, Dan Dobrin, Chris Bono, Artem Bilan
|
||||
|
||||
*{project-version}*
|
||||
|
||||
:docinfo: shared
|
||||
|
||||
The reference documentation consists of the following sections:
|
||||
|
||||
[horizontal]
|
||||
<<spring-cloud-function.adoc#,Reference Guide>> :: Spring Cloud Function Reference
|
||||
https://github.com/spring-cloud/spring-cloud-function/tree/master/spring-cloud-function-samples/function-sample-cloudevent[Cloud Events] :: Cloud Events
|
||||
https://github.com/spring-cloud/spring-cloud-function/tree/master/spring-cloud-function-rsocket[RSocket] :: RSocket
|
||||
xref:spring-integration.adoc[Spring Integration] :: Spring Integration Framework Interaction
|
||||
<<aws.adoc#,AWS Adapter>> :: AWS Adapter Reference
|
||||
<<azure.adoc#, Azure Adapter>> :: Azure Adapter Reference
|
||||
<<gcp.adoc#, GCP Adapter>> :: GCP Adapter Reference
|
||||
|
||||
|
||||
Relevant Links:
|
||||
|
||||
[horizontal]
|
||||
https://projectreactor.io/[Reactor] :: Project Reactor
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
= Introduction
|
||||
|
||||
Spring Cloud Function is a project with the following high-level goals:
|
||||
|
||||
* Promote the implementation of business logic via functions.
|
||||
@@ -1,16 +1,18 @@
|
||||
[[spring-cloud-function]]
|
||||
= Spring Cloud Function
|
||||
:page-section-summary-toc: 1
|
||||
|
||||
Mark Fisher, Dave Syer, Oleg Zhurakousky, Anshul Mehra, Dan Dobrin
|
||||
|
||||
*{project-version}*
|
||||
|
||||
---
|
||||
|
||||
:github: https://github.com/spring-cloud/spring-cloud-function
|
||||
:githubmaster: {github}/tree/master
|
||||
:docslink: {githubmaster}/docs/src/main/asciidoc
|
||||
:nofooter:
|
||||
:branch: master
|
||||
* xref:spring-cloud-function/introduction.adoc[]
|
||||
** xref:spring-cloud-function/programming-model.adoc[]
|
||||
** xref:spring-cloud-function/standalone-web-applications.adoc[]
|
||||
** xref:spring-cloud-function/standalone-streaming-applications.adoc[]
|
||||
** xref:spring-cloud-function/deploying-a-packaged.adoc[]
|
||||
** xref:spring-cloud-function/functional-bean-definitions.adoc[]
|
||||
** xref:spring-cloud-function/serverless-platform-adapters.adoc[]
|
||||
|
||||
** xref:spring-cloud-function/getting-started.adoc[]
|
||||
** xref:spring-cloud-function/programming-model.adoc[]
|
||||
#** xref:spring-cloud-function/standalone-web-applications.adoc[]
|
||||
#** xref:spring-cloud-function/standalone-streaming-applications.adoc[]
|
||||
#** xref:spring-cloud-function/deploying-a-packaged.adoc[]
|
||||
#** xref:spring-cloud-function/functional-bean-definitions.adoc[]
|
||||
#** xref:spring-cloud-function/serverless-platform-adapters.adoc[]
|
||||
@@ -0,0 +1,8 @@
|
||||
[[apendix]]
|
||||
= Apendix
|
||||
:page-section-summary-toc: 1
|
||||
|
||||
Relevant Links:
|
||||
|
||||
[horizontal]
|
||||
https://projectreactor.io/[Reactor] :: Project Reactor
|
||||
@@ -1,8 +1,3 @@
|
||||
[[introduction]]
|
||||
= Introduction
|
||||
:page-section-summary-toc: 1
|
||||
|
||||
include:../:_intro.adoc[]
|
||||
|
||||
include:../:https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing-docs.adoc[]
|
||||
include::../intro.adoc[]
|
||||
|
||||
|
||||
@@ -2,14 +2,8 @@
|
||||
= Serverless Platform Adapters
|
||||
:page-section-summary-toc: 1
|
||||
|
||||
As well as being able to run as a standalone process, a Spring Cloud
|
||||
As well as being able to run as standalone process, Spring Cloud
|
||||
Function application can be adapted to run one of the existing
|
||||
serverless platforms. In the project there are adapters for
|
||||
https://github.com/spring-cloud/spring-cloud-function/tree/{branch}/spring-cloud-function-adapters/spring-cloud-function-adapter-aws[AWS
|
||||
Lambda], and https://github.com/spring-cloud/spring-cloud-function/tree/{branch}/spring-cloud-function-adapters/spring-cloud-function-adapter-azure[Azure]. The https://github.com/fnproject/fn[Oracle Fn platform] has its own Spring Cloud Function adapter. And https://projectriff.io[Riff] supports Java functions and its
|
||||
https://github.com/projectriff/java-function-invoker[Java Function Invoker] acts natively is an adapter for Spring Cloud Function jars.
|
||||
|
||||
include:../:adapters/aws-intro.adoc[]
|
||||
include:../:adapters/azure-intro.adoc[leveloffset=+1]
|
||||
include:../:adapters/gcp-intro.adoc[]
|
||||
|
||||
Lambda], and https://github.com/spring-cloud/spring-cloud-function/tree/{branch}/spring-cloud-function-adapters/spring-cloud-function-adapter-azure[Azure].
|
||||
|
||||
Reference in New Issue
Block a user