Fix indentation for all pages

This commit is contained in:
Marcin Grzejszczak
2023-09-08 15:57:04 +02:00
parent 4d41d8b1fb
commit dcda6d0e66
7 changed files with 57 additions and 57 deletions

View File

@@ -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]
[[introduction]]
== Introduction
= Introduction
include::_intro.adoc[]
[[getting-started]]
== Getting Started
= Getting Started
include::getting-started.adoc[]
[[building]]
== Building
= Building
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/building.adoc[]
[[contributing]]
== Contributing
= Contributing
include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing.adoc[]

View File

@@ -1,7 +1,7 @@
:branch: master
[[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.
@@ -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.
[[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_
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
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`.
@@ -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
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.
@@ -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`.
[[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.
[[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
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
In order to run Spring Cloud Function applications on AWS Lambda, you can leverage Maven or Gradle
plugins offered by the cloud platform provider.
[[maven]]
===== Maven
=== Maven
In order to use the adapter plugin for Maven, add the plugin dependency to your `pom.xml`
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].
[[gradle]]
===== Gradle
=== Gradle
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].
[[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).
@@ -306,7 +306,7 @@ NOTE: The AWS sample app is written in the "functional" style (as an `Applicatio
[[type-conversion]]
==== 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.
@@ -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`.
[[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
function signature to accept `InputStream`. For example, `Function<InputStream, ?>`. In this case

View File

@@ -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.
[[introduction]]
== Introduction
= Introduction
include::adapters/aws-intro.adoc[]
[[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
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
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
@@ -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.
[[platform-specific-features]]
== Platform Specific Features
= Platform Specific Features
[[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).
@@ -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).
[[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.

View File

@@ -1,7 +1,7 @@
:branch: master
[[microsoft-azure-functions]]
== 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.
@@ -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.
[[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:
@@ -55,7 +55,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 <<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.
[[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.
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.
[[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`.
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]]
=== 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].
@@ -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.
[[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.
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].
[[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!
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]]
==== 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.
@@ -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.
[[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.
@@ -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).
[[samples]]
=== Samples
== Samples
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)].
[[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].
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
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)].
[[azure.usage]]
== Usage
= Usage
Common instructions for building and deploying both, `Azure Adapter` and `Azure Web Adapter` type of applications.
[[build]]
=== Build
== Build
====
[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
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.
@@ -449,7 +449,7 @@ Then run the sample:
====
[[running-on-azure]]
=== Running on Azure
== Running on Azure
Make sure you are logged in your Azure account.
@@ -474,7 +474,7 @@ and deploy
====
[[debug-locally]]
=== Debug locally
== Debug locally
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)
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.
[[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://spring.io/blog/2023/02/24/spring-cloud-function-for-azure-function[Spring Cloud Function for Azure Function (blog)]

View File

@@ -1,13 +1,13 @@
:branch: master
[[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.
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,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].
[[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.
[[getting-started]]
===== Getting Started
=== Getting Started
Lets 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
Start by packaging your application.
@@ -164,7 +164,7 @@ public Function<String, Message<String>> function() {
[[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.
@@ -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].
[[getting-started]]
===== Getting Started
=== Getting Started
Lets 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.
[[deploy-to-gcp]]
===== Deploy to GCP
=== Deploy to GCP
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].
[[sample-functions]]
==== Sample Functions
== Sample Functions
The project provides the following sample functions as reference:

View File

@@ -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.
[[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 +115,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,
@@ -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.
[[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
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
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:

View File

@@ -1,5 +1,5 @@
[[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.
It enables lightweight messaging within Spring-based applications and supports integration with external systems via declarative adapters.