Sync docs from master to gh-pages
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
<title>Introduction</title>
|
||||
<link rel="stylesheet" href="css/spring.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||
|
||||
<style>
|
||||
.hidden {
|
||||
display: none;
|
||||
@@ -28,12 +29,18 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.switch--item:not(:first-child) {
|
||||
border-width: 0 0 0 1px;
|
||||
border-style: solid;
|
||||
border-color: #7a2518;
|
||||
}
|
||||
|
||||
.switch--item.selected {
|
||||
background-color: #7a2519;
|
||||
color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
<script src="http://cdnjs.cloudflare.com/ajax/libs/zepto/1.2.0/zepto.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.2.0/zepto.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
function addBlockSwitches() {
|
||||
$('.primary').each(function() {
|
||||
@@ -81,25 +88,16 @@ function createSwitchItem(block, blockSwitch) {
|
||||
|
||||
$(addBlockSwitches);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
</head>
|
||||
<body class="book toc2 toc-left">
|
||||
<div id="header">
|
||||
<div id="toc" class="toc2">
|
||||
<div id="toctitle">Table of Contents</div>
|
||||
<ul class="sectlevel1">
|
||||
<li><a href="#_introduction">Introduction</a></li>
|
||||
<li><a href="#_notes_on_jar_layout">Notes on JAR Layout</a></li>
|
||||
<li><a href="#_build_file_setup">Build file setup</a>
|
||||
<li><a href="#_introduction">Introduction</a>
|
||||
<ul class="sectlevel2">
|
||||
<li><a href="#_maven">Maven</a></li>
|
||||
<li><a href="#_gradle">Gradle</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#_upload">Upload</a></li>
|
||||
<li><a href="#_type_conversion">Type Conversion</a>
|
||||
<ul class="sectlevel3">
|
||||
<li><a href="#_raw_input">Raw Input</a></li>
|
||||
<li><a href="#_aws_lambda">AWS Lambda</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#_functional_bean_definitions">Functional Bean Definitions</a></li>
|
||||
@@ -118,9 +116,6 @@ $(addBlockSwitches);
|
||||
<div class="paragraph">
|
||||
<p><strong>3.0.0.BUILD-SNAPSHOT</strong></p>
|
||||
</div>
|
||||
<div id="index-link" class="paragraph">
|
||||
<p><a href="https://cloud.spring.io/spring-cloud-function/home.html" class="bare">https://cloud.spring.io/spring-cloud-function/home.html</a></p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>The <a href="https://aws.amazon.com/">AWS</a> adapter takes a Spring Cloud Function app and converts it to a form that can run in AWS Lambda.</p>
|
||||
</div>
|
||||
@@ -129,17 +124,19 @@ $(addBlockSwitches);
|
||||
<div class="sect1">
|
||||
<h2 id="_introduction"><a class="link" href="#_introduction">Introduction</a></h2>
|
||||
<div class="sectionbody">
|
||||
<div class="sect2">
|
||||
<h3 id="_aws_lambda"><a class="link" href="#_aws_lambda">AWS Lambda</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The <a href="https://aws.amazon.com/">AWS</a> adapter takes a Spring Cloud Function app and converts it to a form that can run in AWS Lambda.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>The adapter has a couple of generic request handlers that you can use. The most generic is <code>SpringBootStreamHandler</code>, which uses a Jackson <code>ObjectMapper</code> provided by Spring Boot to serialize and deserialize the objects in the function. There is also a <code>SpringBootRequestHandler</code> 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).</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>If your app has more than one <code>@Bean</code> of type <code>Function</code> etc. then you can choose the one to use by configuring <code>function.name</code> (e.g. as <code>FUNCTION_NAME</code> environment variable in AWS). The functions are extracted from the Spring Cloud <code>FunctionCatalog</code> (searching first for <code>Function</code> then <code>Consumer</code> and finally <code>Supplier</code>).</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
<h2 id="_notes_on_jar_layout"><a class="link" href="#_notes_on_jar_layout">Notes on JAR Layout</a></h2>
|
||||
<div class="sectionbody">
|
||||
<div class="sect3">
|
||||
<h4 id="_notes_on_jar_layout"><a class="link" href="#_notes_on_jar_layout">Notes on JAR Layout</a></h4>
|
||||
<div class="paragraph">
|
||||
<p>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
|
||||
@@ -186,16 +183,14 @@ then additional transformers must be configured as part of the maven-shade-plugi
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
<h2 id="_build_file_setup"><a class="link" href="#_build_file_setup">Build file setup</a></h2>
|
||||
<div class="sectionbody">
|
||||
<div class="sect3">
|
||||
<h4 id="_build_file_setup"><a class="link" href="#_build_file_setup">Build file setup</a></h4>
|
||||
<div class="paragraph">
|
||||
<p>In order to run Spring Cloud Function applications on AWS Lambda, you can leverage Maven or Gradle
|
||||
plugins offered by the cloud platform provider.</p>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_maven"><a class="link" href="#_maven">Maven</a></h3>
|
||||
<div class="sect4">
|
||||
<h5 id="_maven"><a class="link" href="#_maven">Maven</a></h5>
|
||||
<div class="paragraph">
|
||||
<p>In order to use the adapter plugin for Maven, add the plugin dependency to your <code>pom.xml</code>
|
||||
file:</p>
|
||||
@@ -235,11 +230,11 @@ The example of the <a href="#shade-plugin-setup">setup</a> can be found above.</
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>You can find the entire sample <code>pom.xml</code> file for deploying Spring Cloud Function
|
||||
applications to AWS Lambda with Maven <a href="https://github.com/spring-cloud/spring-cloud-function/blob/2.1.x/spring-cloud-function-samples/function-sample-aws/pom.xml">here</a>.</p>
|
||||
applications to AWS Lambda with Maven <a href="https://github.com/spring-cloud/spring-cloud-function/blob/{branch}/spring-cloud-function-samples/function-sample-aws/pom.xml">here</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_gradle"><a class="link" href="#_gradle">Gradle</a></h3>
|
||||
<div class="sect4">
|
||||
<h5 id="_gradle"><a class="link" href="#_gradle">Gradle</a></h5>
|
||||
<div class="paragraph">
|
||||
<p>In order to use the adapter plugin for Gradle, add the dependency to your <code>build.gradle</code> file:</p>
|
||||
</div>
|
||||
@@ -304,14 +299,12 @@ assemble.dependsOn = [thinJar]</code></pre>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>You can find the entire sample <code>build.gradle</code> file for deploying Spring Cloud Function
|
||||
applications to AWS Lambda with Gradle <a href="https://github.com/spring-cloud/spring-cloud-function/blob/2.1.x/spring-cloud-function-samples/function-sample-aws/build.gradle">here</a>.</p>
|
||||
applications to AWS Lambda with Gradle <a href="https://github.com/spring-cloud/spring-cloud-function/blob/{branch}/spring-cloud-function-samples/function-sample-aws/build.gradle">here</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
<h2 id="_upload"><a class="link" href="#_upload">Upload</a></h2>
|
||||
<div class="sectionbody">
|
||||
<div class="sect3">
|
||||
<h4 id="_upload"><a class="link" href="#_upload">Upload</a></h4>
|
||||
<div class="paragraph">
|
||||
<p>Build the sample under <code>spring-cloud-function-samples/function-sample-aws</code> and upload the <code>-aws</code> jar file to Lambda. The handler can be <code>example.Handler</code> or <code>org.springframework.cloud.function.adapter.aws.SpringBootStreamHandler</code> (FQN of the class, <em>not</em> a method reference, although Lambda does accept method references).</p>
|
||||
</div>
|
||||
@@ -351,10 +344,8 @@ The AWS sample app is written in the "functional" style (as an <code>Application
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
<h2 id="_type_conversion"><a class="link" href="#_type_conversion">Type Conversion</a></h2>
|
||||
<div class="sectionbody">
|
||||
<div class="sect3">
|
||||
<h4 id="_type_conversion"><a class="link" href="#_type_conversion">Type Conversion</a></h4>
|
||||
<div class="paragraph">
|
||||
<p>Spring Cloud Function will attempt to transparently handle type conversion between the raw
|
||||
input stream and types declared by your function.</p>
|
||||
@@ -367,8 +358,8 @@ incoming stream event to an instance of <code>Foo</code>.</p>
|
||||
<p>In the event type is not known or can not be determined (e.g., <code>Function<?, ?></code>) we will attempt to
|
||||
convert an incoming stream event to a generic <code>Map</code>.</p>
|
||||
</div>
|
||||
<div class="sect3">
|
||||
<h4 id="_raw_input"><a class="link" href="#_raw_input">Raw Input</a></h4>
|
||||
<div class="sect5">
|
||||
<h6 id="_raw_input"><a class="link" href="#_raw_input">Raw Input</a></h6>
|
||||
<div class="paragraph">
|
||||
<p>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 <code>InputStream</code>. For example, <code>Function<InputStream, ?></code>. In this case
|
||||
@@ -377,6 +368,8 @@ we will not attempt any conversion and will pass the raw input directly to a fun
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
<h2 id="_functional_bean_definitions"><a class="link" href="#_functional_bean_definitions">Functional Bean Definitions</a></h2>
|
||||
<div class="sectionbody">
|
||||
|
||||
Reference in New Issue
Block a user