diff --git a/docs/modules/ROOT/pages/adapters/aws-intro.adoc b/docs/modules/ROOT/pages/adapters/aws-intro.adoc index 86419bdcf..6b02e176c 100644 --- a/docs/modules/ROOT/pages/adapters/aws-intro.adoc +++ b/docs/modules/ROOT/pages/adapters/aws-intro.adoc @@ -44,7 +44,7 @@ appropriate AWS deployable JAR file. (You can read more details about 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. +When asked 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"] @@ -62,7 +62,7 @@ to use. The next section will explain you how you can accomplish just that. 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. . +It will handle most of the cases 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` @@ -133,10 +133,10 @@ java -Dspring.main.web-application-type=none -Dspring.jmx.enabled=false \ ``` 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`). +Set the handler name in AWS to the name of your function. You can use function composition here as well (e.g., `uppercase|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. +where you can also see how to configure your 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 diff --git a/docs/modules/ROOT/pages/adapters/aws.adoc b/docs/modules/ROOT/pages/adapters/aws.adoc index fe35449d0..f5c4d1977 100644 --- a/docs/modules/ROOT/pages/adapters/aws.adoc +++ b/docs/modules/ROOT/pages/adapters/aws.adoc @@ -47,7 +47,7 @@ appropriate AWS deployable JAR file. (You can read more details about 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. +When asked 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"] @@ -65,7 +65,7 @@ to use. The next section will explain you how you can accomplish just that. 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. . +It will handle most of the cases 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` @@ -143,10 +143,10 @@ java -Dspring.main.web-application-type=none -Dspring.jmx.enabled=false \ ``` 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`). +Set the handler name in AWS to the name of your function. You can use function composition here as well (e.g., `uppercase|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. +where you can also see how to configure your 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 diff --git a/docs/modules/ROOT/pages/adapters/gcp-intro.adoc b/docs/modules/ROOT/pages/adapters/gcp-intro.adoc index 04480c856..4b5054408 100644 --- a/docs/modules/ROOT/pages/adapters/gcp-intro.adoc +++ b/docs/modules/ROOT/pages/adapters/gcp-intro.adoc @@ -109,7 +109,7 @@ curl http://localhost:8080/ -d "hello" ---- -== Buikd & Deploy to GCP +== Build & Deploy to GCP Start by packaging your application. diff --git a/docs/modules/ROOT/pages/spring-cloud-function/deploying-a-packaged.adoc b/docs/modules/ROOT/pages/spring-cloud-function/deploying-a-packaged.adoc index a3b6ce4a1..932d502b7 100644 --- a/docs/modules/ROOT/pages/spring-cloud-function/deploying-a-packaged.adoc +++ b/docs/modules/ROOT/pages/spring-cloud-function/deploying-a-packaged.adoc @@ -19,7 +19,7 @@ the functions. It can optionally use a `maven:` prefix to locate the artifact vi for complete details). A Spring Boot application is bootstrapped from the jar file, using the `MANIFEST.MF` to locate a start class, so that a standard Spring Boot fat jar works well, for example. If the target jar can be launched successfully then the result is a function registered in the main application's `FunctionCatalog`. The registered function can be applied by code in the main application, even though -it was created in an isolated class loader (by deault). +it was created in an isolated class loader (by default). Here is the example of deploying a JAR which contains an 'uppercase' function and invoking it . diff --git a/docs/modules/ROOT/pages/spring-cloud-function/programming-model.adoc b/docs/modules/ROOT/pages/spring-cloud-function/programming-model.adoc index 9b5df6350..51cf7e016 100644 --- a/docs/modules/ROOT/pages/spring-cloud-function/programming-model.adoc +++ b/docs/modules/ROOT/pages/spring-cloud-function/programming-model.adoc @@ -55,13 +55,13 @@ Function uppercase = catalog.lookup(“uppercase”); ---- Important to understand that given that `uppercase` is a bean, you can certainly get it form the `ApplicationContext` directly, but all you will get is just your bean as you declared it without any extra features provided by SCF. When you do lookup of a function via `FunctionCatalog`, the instance you will receive is wrapped (instrumented) with additional features (i.e., type conversion, composition etc.) described in this manual. Also, it is important to understand that a typical user does not use Spring Cloud Function directly. Instead a typical user implements Java `Function/Supplier/Consumer` with the idea of using it in different execution contexts without additional work. For example the same java function could be represented as _REST endpoint_ or _Streaming message handler_ or _AWS Lambda_ and more via Spring Cloud Function provided -adapters as well as other frameworks using Spring Cloud Function as the core programming model (e.g., https://spring.io/projects/spring-cloud-stream[Spring Cloud Stream]) +adapters as well as other frameworks using Spring Cloud Function as the core programming model (e.g., https://spring.io/projects/spring-cloud-stream[Spring Cloud Stream]). So in summary Spring Cloud Function instruments java functions with additional features to be utilised in variety of execution contexts. [[function-definition]] === Function definition -While the previous example shows you how to lookup function in FunctionCatalog programmatically, in a typical integration case where Spring Cloud Function used as programming model by another framework (e.fg. Spring Cloud Stream), you declare which functions to use via `spring.cloud.function.definition` property. Knowing that it is important to understand some default behaviour when it comes to discovering functions in `FunctionCatalog`. For example, if you only have one Functional bean in your `ApplicationContext`, the `spring.cloud.function.definition` property typically will not be required, since a single function in `FunctionCatalog` can be looked up by an empty name or any name. For example, assuming that `uppercase` is the only function in your catalog, it can be looked up as `catalog.lookup(null)`, `catalog.lookup(“”)`, `catalog.lookup(“foo”)` +While the previous example shows you how to lookup function in FunctionCatalog programmatically, in a typical integration case where Spring Cloud Function used as programming model by another framework (e.g., https://spring.io/projects/spring-cloud-stream[Spring Cloud Stream]), you declare which functions to use via `spring.cloud.function.definition` property. Knowing that it is important to understand some default behaviour when it comes to discovering functions in `FunctionCatalog`. For example, if you only have one Functional bean in your `ApplicationContext`, the `spring.cloud.function.definition` property typically will not be required, since a single function in `FunctionCatalog` can be looked up by an empty name or any name. For example, assuming that `uppercase` is the only function in your catalog, it can be looked up as `catalog.lookup(null)`, `catalog.lookup(“”)`, `catalog.lookup(“foo”)`. That said, for cases where you are using framework such as Spring Cloud Stream which uses `spring.cloud.function.definition` it is best practice and recommended to always use `spring.cloud.function.definition` property. For example, @@ -169,7 +169,7 @@ And of course you can't compose uncomposable such as Consumer and Function, Cons == Function Routing and Filtering Since version 2.2 Spring Cloud Function provides routing feature allowing -you to invoke a single function which acts as a router to an actual function you wish to invoke +you to invoke a single function which acts as a router to an actual function you wish to invoke. This feature is very useful in certain FAAS environments where maintaining configurations for several functions could be cumbersome or exposing more than one function is not possible. diff --git a/docs/modules/ROOT/pages/spring-cloud-function/standalone-web-applications.adoc b/docs/modules/ROOT/pages/spring-cloud-function/standalone-web-applications.adoc index d80f6bcb4..374290089 100644 --- a/docs/modules/ROOT/pages/spring-cloud-function/standalone-web-applications.adoc +++ b/docs/modules/ROOT/pages/spring-cloud-function/standalone-web-applications.adoc @@ -46,7 +46,7 @@ See <> to see the details and example on how to As you have noticed from the previous table, you can pass an argument to a function as path variable (i.e., `/\{function}/\{item}`). For example, `http://localhost:8080/uppercase/foo` will result in calling `uppercase` function with its input parameter being `foo`. -While this is the recommended approach and the one that fits most use cases cases, there are times when you have to deal with HTTP request parameters (e.g., `http://localhost:8080/uppercase/foo?name=Bill`) +While this is the recommended approach and the one that fits most use cases cases, there are times when you have to deal with HTTP request parameters (e.g., `http://localhost:8080/uppercase/foo?name=Bill`). The framework will treat HTTP request parameters similar to the HTTP headers by storing them in the `Message` headers under the header key `http_request_param` with its value being a `Map` of request parameters, so in order to access them your function input signature should accept `Message` type (e.g., `Function, String>`). For convenience we provide `HeaderUtils.HTTP_REQUEST_PARAM` constant. @@ -82,7 +82,7 @@ of the actual URL, giving user ability to use it for evaluation and computation. In situations where there are more than one function in catalog there may be a need to only export certain functions or function compositions. In that case you can use the same `spring.cloud.function.definition` property listing functions you intend to export delimited by `;`. -Note that in this case nothing will be mapped to the root path and functions that are not listed (including compositions) are not going to be exported +Note that in this case nothing will be mapped to the root path and functions that are not listed (including compositions) are not going to be exported. For example, @@ -101,7 +101,7 @@ This will only export function composition `foo|bar` and function `baz` regardle == Http Headers propagation By default most request `HttpHeaders` are copied into the response `HttpHeaders`. If you require to filter out certain headers you can provide the names of those headers using -`spring.cloud.function.http.ignored-headers` delimited by comas. For example, `spring.cloud.function.http.ignored-headers=foo,bar` +`spring.cloud.function.http.ignored-headers` delimited by comas. For example, `spring.cloud.function.http.ignored-headers=foo,bar`. [[crud-rest-with-spring-cloud-function]] == CRUD REST with Spring Cloud Function