INT-1582 if the payload is an ApplicationEvent it is passed as-is (no wrapping in MessagingException). Also, general polishing
This commit is contained in:
@@ -13,21 +13,20 @@
|
||||
<title>Receiving Spring ApplicationEvents</title>
|
||||
<para>
|
||||
To receive events and send them to a channel, simply define an instance of Spring Integration's
|
||||
<classname>ApplicationEventListeningChannelAdapter</classname>. This class is an implementation of
|
||||
<classname>ApplicationEventListeningMessageProducer</classname>. This class is an implementation of
|
||||
Spring's <interfacename>ApplicationListener</interfacename> interface. By default it will pass all
|
||||
received events as Spring Integration Messages. To limit based on the type of event, configure the
|
||||
list of event types that you want to receive with the 'eventTypes' property.
|
||||
</para>
|
||||
<para>
|
||||
For convenience namespace support was provided to configure <classname>ApplicationEventListeningChannelAdapter</classname> via <emphasis>inbound-channel-adapter</emphasis>
|
||||
<programlisting language="xml"><![CDATA[<int-event:inbound-channel-adapter channel="input" event-types="foo.bar.FooApplicationEvent, foo.bar.BarApplicationEvent"/>
|
||||
For convenience namespace support was provided to configure <classname>ApplicationEventListeningMessageProducer</classname> via <emphasis>inbound-channel-adapter</emphasis>
|
||||
<programlisting language="xml"><![CDATA[<int-event:inbound-channel-adapter channel="eventChannel" event-types="example.FooEvent, example.BarEvent"/>
|
||||
|
||||
<int:publish-subscribe-channel id="sampleEventChannel"/>]]></programlisting>
|
||||
In the above sample, all Application Context events that are of type specified by the 'event-types' (optional) attribute will be
|
||||
delivered as Spring Integration Messages to 'sampleEventChannel'.
|
||||
<int:publish-subscribe-channel id="eventChannel"/>]]></programlisting>
|
||||
In the above example, all Application Context events that match one of the types specified by the 'event-types' (optional) attribute will be
|
||||
delivered as Spring Integration Messages to 'eventChannel'.
|
||||
</para>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
<section id="applicationevent-outbound">
|
||||
@@ -41,21 +40,21 @@ delivered as Spring Integration Messages to 'sampleEventChannel'.
|
||||
</para>
|
||||
<para>
|
||||
For convenience namespace support was provided to configure <classname>ApplicationEventPublishingMessageHandler</classname> via <emphasis>outbound-channel-adapter</emphasis> element
|
||||
<programlisting language="xml"><![CDATA[<int:channel id="input"/>
|
||||
<programlisting language="xml"><![CDATA[<int:channel id="eventChannel"/>
|
||||
|
||||
<int-event:outbound-channel-adapter channel="input"/>]]></programlisting>
|
||||
If you are using PollableChannel (e.g., Queue), you can also provide <emphasis>poller</emphasis> as sub-element of <emphasis>outbound-channel-adapter</emphasis>, optionally providing <emphasis>task-executor</emphasis>
|
||||
<programlisting language="xml"><![CDATA[<int:channel id="input">
|
||||
<int-event:outbound-channel-adapter channel="eventChannel"/>]]></programlisting>
|
||||
If you are using a PollableChannel (e.g., Queue), you can also provide <emphasis>poller</emphasis> as a sub-element of the <emphasis>outbound-channel-adapter</emphasis> element. You can also optionally provide a <emphasis>task-executor</emphasis> reference for that poller.
|
||||
<programlisting language="xml"><![CDATA[<int:channel id="eventChannel">
|
||||
<int:queue/>
|
||||
</int:channel>
|
||||
|
||||
<int-event:outbound-channel-adapter channel="input">
|
||||
<int-event:outbound-channel-adapter channel="eventChannel">
|
||||
<int:poller max-messages-per-poll="1" task-executor="executor" fixed-rate="100"/>
|
||||
</int-event:outbound-channel-adapter>
|
||||
|
||||
<task:executor id="executor" pool-size="5"/>]]></programlisting>
|
||||
|
||||
In the above sample, all messages sent to an 'input' channel will be published as ApplicationEvents to Spring Application sContext
|
||||
In the above example, all messages sent to the 'eventChannel' channel will be published as ApplicationEvents to any relevant ApplicationListeners within the Spring ApplicationContext. If the payload of the Message is an ApplicationEvent, it will be passed as-is. Otherwise the Message itself will be wrapped in a MessagingEvent instance.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user