Added Channel Adapter and Service Activator chapters
This commit is contained in:
45
spring-integration-reference/src/service-activator.xml
Normal file
45
spring-integration-reference/src/service-activator.xml
Normal file
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
||||
<chapter id="service-activator">
|
||||
<title>Service Activator</title>
|
||||
|
||||
<section id="service-activator-introduction">
|
||||
<title>Introduction</title>
|
||||
<para>
|
||||
The Service Activator is the endpoint type for connecting any Spring-managed Object to an input channel so that
|
||||
it may play the role of a service. If the service produces output, it may also be connected to an output channel.
|
||||
Alternatively, an output producing service may be located at the end of a processing pipeline or message flow in
|
||||
which case, the inbound Message's "replyChannel" header can be used. This is the default behavior if no output
|
||||
channel is defined, and as with most of the configuration options you'll see here, the same behavior actually
|
||||
applies for most of the other components we have seen.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="service-activator-namespace">
|
||||
<title>The <service-activator/> Element</title>
|
||||
<para>
|
||||
To create a Service Activator, use the 'service-activator' element with the 'input-channel' and 'ref' attributes:
|
||||
<programlisting language="xml"><service-activator input-channel="exampleChannel" ref="exampleHandler"/></programlisting>
|
||||
</para>
|
||||
<para>
|
||||
The configuration above assumes that "exampleHandler" either contains a single method annotated with the
|
||||
@ServiceActivator annotation or that it contains only one public method at all. To delegate to an explicitly
|
||||
defined method of any object, simply add the "method" attribute.
|
||||
<programlisting language="xml"><service-activator input-channel="exampleChannel" ref="somePojo" method="someMethod"/></programlisting>
|
||||
</para>
|
||||
<para>
|
||||
In either case, when the service method returns a non-null value, the endpoint will attempt to send the reply
|
||||
message to an appropriate reply channel. To determine the reply channel, it will first check if an
|
||||
"output-channel" was provided in the endpoint configuration:
|
||||
<programlisting language="xml"><service-activator input-channel="exampleChannel" output-channel="replyChannel"
|
||||
ref="somePojo" method="someMethod"/></programlisting>
|
||||
If no "output-channel" is available, it will then check the Message's <literal>RETURN_ADDRESS</literal> header
|
||||
value. If that value is available, it will then check its type. If it is a
|
||||
<interfacename>MessageChannel</interfacename>, the reply message will be sent to that channel. If it is a
|
||||
<classname>String</classname>, then the endpoint will attempt to resolve the channel name to a channel instance.
|
||||
If the channel cannot be resolved, then a <classname>ChannelResolutionException</classname> will be thrown.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
</chapter>
|
||||
Reference in New Issue
Block a user