Files
spring-cloud-static/spring-cloud-function/2.0.0.RC3/multi/multi__building_and_running_a_function.html
2018-12-20 19:14:39 +00:00

18 lines
3.6 KiB
HTML

<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>3.&nbsp;Building and Running a Function</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-function.html" title="Spring Cloud Function"><link rel="up" href="multi_spring-cloud-function.html" title="Spring Cloud Function"><link rel="prev" href="multi__getting_started.html" title="2.&nbsp;Getting Started"><link rel="next" href="multi__function_catalog_and_flexible_function_signatures.html" title="4.&nbsp;Function Catalog and Flexible Function Signatures"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">3.&nbsp;Building and Running a Function</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__getting_started.html">Prev</a>&nbsp;</td><th width="60%" align="center">&nbsp;</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="multi__function_catalog_and_flexible_function_signatures.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_building_and_running_a_function" href="#_building_and_running_a_function"></a>3.&nbsp;Building and Running a Function</h1></div></div></div><p>The sample <code class="literal">@SpringBootApplication</code> above has a function that can be
decorated at runtime by Spring Cloud Function to be an HTTP endpoint,
or a Stream processor, for instance with RabbitMQ, Apache Kafka or
JMS.</p><p>The <code class="literal">@Beans</code> can be <code class="literal">Function</code>, <code class="literal">Consumer</code> or <code class="literal">Supplier</code> (all from
<code class="literal">java.util</code>), and their parametric types can be String or POJO.</p><p>Functions can also be of <code class="literal">Flux&lt;String&gt;</code> or <code class="literal">Flux&lt;Pojo&gt;</code> and Spring
Cloud Function takes care of converting the data to and from the
desired types, as long as it comes in as plain text or (in the case of
the POJO) JSON. There is also support for <code class="literal">Message&lt;Pojo&gt;</code> where the
message headers are copied from the incoming event, depending on the
adapter. The web adapter also supports conversion from form-encoded
data to a <code class="literal">Map</code>, and if you are using the function with Spring Cloud
Stream then all the conversion and coercion features for message
payloads will be applicable as well.</p><p>Functions can be grouped together in a single application, or deployed
one-per-jar. It&#8217;s up to the developer to choose. An app with multiple
functions can be deployed multiple times in different "personalities",
exposing different functions over different physical transports.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__getting_started.html">Prev</a>&nbsp;</td><td width="20%" align="center">&nbsp;</td><td width="40%" align="right">&nbsp;<a accesskey="n" href="multi__function_catalog_and_flexible_function_signatures.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2.&nbsp;Getting Started&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-function.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;4.&nbsp;Function Catalog and Flexible Function Signatures</td></tr></table></div></body></html>