From 570bbb23b57b6a8f071b60fc9040eb94b1e8af4d Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Fri, 12 Jul 2019 16:52:33 +0200 Subject: [PATCH] Fixed doc rendering --- README.adoc | 1 + docs/pom.xml | 74 +++++++-------- docs/src/main/asciidoc/README.adoc | 2 +- .../main/asciidoc/{intro.adoc => _intro.adoc} | 0 .../main/asciidoc/adapters/aws-readme.adoc | 2 +- .../main/asciidoc/adapters/azure-readme.adoc | 2 +- .../asciidoc/adapters/openwhisk-readme.adoc | 2 +- .../main/asciidoc/spring-cloud-function.adoc | 2 +- .../README.adoc | 95 +------------------ .../README.adoc | 2 +- .../README.adoc | 2 +- 11 files changed, 46 insertions(+), 138 deletions(-) rename docs/src/main/asciidoc/{intro.adoc => _intro.adoc} (100%) diff --git a/README.adoc b/README.adoc index f04b04876..3b674bbc8 100644 --- a/README.adoc +++ b/README.adoc @@ -347,6 +347,7 @@ $ touch .springformat ==== Intellij IDEA In order to setup Intellij you should import our coding conventions, inspection profiles and set up the checkstyle plugin. +The following files can be found in the https://github.com/spring-cloud/spring-cloud-build/tree/master/spring-cloud-build-tools[Spring Cloud Build] project. .spring-cloud-build-tools/ ---- diff --git a/docs/pom.xml b/docs/pom.xml index 3157e3c11..14cdae5a4 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -221,43 +221,43 @@ run - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + assert-no-unresolved-links diff --git a/docs/src/main/asciidoc/README.adoc b/docs/src/main/asciidoc/README.adoc index 3355be042..966e82208 100644 --- a/docs/src/main/asciidoc/README.adoc +++ b/docs/src/main/asciidoc/README.adoc @@ -2,7 +2,7 @@ image::https://travis-ci.org/spring-cloud/spring-cloud-function.svg?branch=maste == Introduction -include::intro.adoc[] +include::_intro.adoc[] == Getting Started diff --git a/docs/src/main/asciidoc/intro.adoc b/docs/src/main/asciidoc/_intro.adoc similarity index 100% rename from docs/src/main/asciidoc/intro.adoc rename to docs/src/main/asciidoc/_intro.adoc diff --git a/docs/src/main/asciidoc/adapters/aws-readme.adoc b/docs/src/main/asciidoc/adapters/aws-readme.adoc index 9698a3dd6..a33ffe8ad 100644 --- a/docs/src/main/asciidoc/adapters/aws-readme.adoc +++ b/docs/src/main/asciidoc/adapters/aws-readme.adoc @@ -1,3 +1,3 @@ This project provides an adapter layer for a Spring Cloud Function application onto AWS Lambda. You can write an app with a single `@Bean` of type `Function`, `Consumer` or `Supplier` and it will be deployable in AWS if you get the JAR file laid out right. The best way to make it work is to include `spring-cloud-function-context` as a dependency, but not the higher level adapters (e.g. `spring-cloud-function-stream`). -include::adapters/aws-intro.adoc[] +include::./adapters/aws-intro.adoc[] diff --git a/docs/src/main/asciidoc/adapters/azure-readme.adoc b/docs/src/main/asciidoc/adapters/azure-readme.adoc index 7f84acb5e..4f14f282a 100644 --- a/docs/src/main/asciidoc/adapters/azure-readme.adoc +++ b/docs/src/main/asciidoc/adapters/azure-readme.adoc @@ -1,7 +1,7 @@ This project provides an adapter layer for a Spring Cloud Function application onto Azure. You can write an app with a single `@Bean` of type `Function` and it will be deployable in Azure if you get the JAR file laid out right. -include::adapters/azure-intro.adoc[] +include::./adapters/azure-intro.adoc[] == Sample Function diff --git a/docs/src/main/asciidoc/adapters/openwhisk-readme.adoc b/docs/src/main/asciidoc/adapters/openwhisk-readme.adoc index 7dd5cc195..022b9c8a9 100644 --- a/docs/src/main/asciidoc/adapters/openwhisk-readme.adoc +++ b/docs/src/main/asciidoc/adapters/openwhisk-readme.adoc @@ -1,6 +1,6 @@ == Quick Start -include::adapters/openwhisk-quick-start.adoc[] +include::./adapters/openwhisk-quick-start.adoc[] == Examples diff --git a/docs/src/main/asciidoc/spring-cloud-function.adoc b/docs/src/main/asciidoc/spring-cloud-function.adoc index 2b408e532..d22cccd06 100644 --- a/docs/src/main/asciidoc/spring-cloud-function.adoc +++ b/docs/src/main/asciidoc/spring-cloud-function.adoc @@ -16,7 +16,7 @@ Mark Fisher, Dave Syer, Oleg Zhurakousky, Anshul Mehra == Introduction -include::intro.adoc[] +include::_intro.adoc[] include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing-docs.adoc[] diff --git a/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/README.adoc b/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/README.adoc index a1f93459c..cd68f3df7 100644 --- a/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/README.adoc +++ b/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/README.adoc @@ -6,97 +6,4 @@ Edit the files in the src/main/asciidoc/ directory instead. This project provides an adapter layer for a Spring Cloud Function application onto AWS Lambda. You can write an app with a single `@Bean` of type `Function`, `Consumer` or `Supplier` and it will be deployable in AWS if you get the JAR file laid out right. The best way to make it work is to include `spring-cloud-function-context` as a dependency, but not the higher level adapters (e.g. `spring-cloud-function-stream`). -The adapter has a couple of generic request handlers that you can use. The most generic is `SpringBootStreamHandler`, which uses a Jackson `ObjectMapper` provided by Spring Boot to serialize and deserialize the objects in the function. There is also a `SpringBootRequestHandler` which you can extend, and provide the input and output types as type parameters (enabling AWS to inspect the class and do the JSON conversions itself). - -If your app has more than one `@Bean` of type `Function` etc. then you can choose the one to use by configuring `function.name` (e.g. as `FUNCTION_NAME` environment variable in AWS). The functions are extracted from the Spring Cloud `FunctionCatalog` (searching first for `Function` then `Consumer` and finally `Supplier`). - -== 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 -shaded, but a Spring Boot standalone application does not, so you can run the same app using 2 -separate jars (as per the sample). The sample app creates 2 jar files, one with an `aws` -classifier for deploying in Lambda, and one executable (thin) jar that includes `spring-cloud-function-web` -at runtime. Spring Cloud Function will try and locate a "main class" for you from the JAR file -manifest, using the `Start-Class` attribute (which will be added for you by the Spring Boot -tooling if you use the starter parent). If there is no `Start-Class` in your manifest you can -use an environment variable or system property `MAIN_CLASS` when you deploy the function to AWS. - -If you are not using the functional bean definitions but relying on Spring Boot's auto-configuration, -then additional transformers must be configured as part of the maven-shade-plugin execution. - -[source, xml] ----- - - org.apache.maven.plugins - maven-shade-plugin - - - org.springframework.boot - spring-boot-maven-plugin - - - - false - true - aws - - - META-INF/spring.handlers - - - META-INF/spring.factories - - - META-INF/spring.schemas - - - - ----- - -== 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 - -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` 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 - -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`. In this case -we will not attempt any conversion and will pass the raw input directly to a function. - - - - +Unresolved directive in aws-readme.adoc - include::./adapters/aws-intro.adoc[] \ No newline at end of file diff --git a/spring-cloud-function-adapters/spring-cloud-function-adapter-azure/README.adoc b/spring-cloud-function-adapters/spring-cloud-function-adapter-azure/README.adoc index 60fa79aca..d98c7fda2 100644 --- a/spring-cloud-function-adapters/spring-cloud-function-adapter-azure/README.adoc +++ b/spring-cloud-function-adapters/spring-cloud-function-adapter-azure/README.adoc @@ -7,7 +7,7 @@ Edit the files in the src/main/asciidoc/ directory instead. This project provides an adapter layer for a Spring Cloud Function application onto Azure. You can write an app with a single `@Bean` of type `Function` and it will be deployable in Azure if you get the JAR file laid out right. -Unresolved directive in azure-readme.adoc - include::adapters/azure-intro.adoc[] +Unresolved directive in azure-readme.adoc - include::./adapters/azure-intro.adoc[] == Sample Function diff --git a/spring-cloud-function-adapters/spring-cloud-function-adapter-openwhisk/README.adoc b/spring-cloud-function-adapters/spring-cloud-function-adapter-openwhisk/README.adoc index 453544785..6a74c8709 100644 --- a/spring-cloud-function-adapters/spring-cloud-function-adapter-openwhisk/README.adoc +++ b/spring-cloud-function-adapters/spring-cloud-function-adapter-openwhisk/README.adoc @@ -6,7 +6,7 @@ Edit the files in the src/main/asciidoc/ directory instead. == Quick Start -Unresolved directive in openwhisk-readme.adoc - include::adapters/openwhisk-quick-start.adoc[] +Unresolved directive in openwhisk-readme.adoc - include::./adapters/openwhisk-quick-start.adoc[] == Examples