From e35de5a05433767462e45c495f56d3077cafadb1 Mon Sep 17 00:00:00 2001 From: Mark Fisher Date: Wed, 3 Nov 2010 13:03:49 -0400 Subject: [PATCH] INT-1583 updated documentation --- docs/src/reference/docbook/event.xml | 69 ++++++++++++++++------------ 1 file changed, 40 insertions(+), 29 deletions(-) diff --git a/docs/src/reference/docbook/event.xml b/docs/src/reference/docbook/event.xml index cc6336d97a..9f759ef787 100644 --- a/docs/src/reference/docbook/event.xml +++ b/docs/src/reference/docbook/event.xml @@ -1,50 +1,59 @@ + Spring ApplicationEvent Support Spring Integration provides support for inbound and outbound ApplicationEvents - as defined by the underlying Spring Framework. For more information about the events and listeners, + as defined by the underlying Spring Framework. For more information about Spring's support for events and listeners, refer to the Spring Reference Manual.
Receiving Spring ApplicationEvents - - To receive events and send them to a channel, simply define an instance of Spring Integration's - ApplicationEventListeningMessageProducer. This class is an implementation of - Spring's ApplicationListener 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. - - - For convenience namespace support was provided to configure ApplicationEventListeningMessageProducer via inbound-channel-adapter - + + To receive events and send them to a channel, simply define an instance of Spring Integration's + ApplicationEventListeningMessageProducer. This class is an implementation of + Spring's ApplicationListener 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. If a received event + has a Message instance as its 'source', then that will be passed as-is. Otherwise, if a SpEL-based + "payloadExpression" has been provided, that will be evaluated against the ApplicationEvent instance. + If the event's source is not a Message instance and no "payloadExpression" has been provided, then + the ApplicationEvent itself will be passed as the payload. + + + For convenience namespace support is provided to configure an ApplicationEventListeningMessageProducer + via the inbound-channel-adapter element. + ]]> 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'. - - +delivered as Spring Integration Messages to the Message Channel named 'eventChannel'. +
- Sending Spring ApplicationEvents - - To send Spring ApplicationEvents, create an instance of the - ApplicationEventPublishingMessageHandler and register it within an endpoint. - This implementation of the MessageHandler interface also implements - Spring's ApplicationEventPublisherAware interface and thus acts as a - bridge between Spring Integration Messages and ApplicationEvents. - - - For convenience namespace support was provided to configure ApplicationEventPublishingMessageHandler via outbound-channel-adapter element - + Sending Spring ApplicationEvents + + To send Spring ApplicationEvents, create an instance of the + ApplicationEventPublishingMessageHandler and register it within an endpoint. + This implementation of the MessageHandler interface also implements + Spring's ApplicationEventPublisherAware interface and thus acts as a + bridge between Spring Integration Messages and ApplicationEvents. + + + + For convenience namespace support is provided to configure an ApplicationEventPublishingMessageHandler + via the outbound-channel-adapter element. + ]]> -If you are using a PollableChannel (e.g., Queue), you can also provide poller as a sub-element of the outbound-channel-adapter element. You can also optionally provide a task-executor reference for that poller. - + If you are using a PollableChannel (e.g., Queue), you can also provide poller as a sub-element of the + outbound-channel-adapter element. You can also optionally provide a task-executor + reference for that poller. The following example demonstrates both. + @@ -54,8 +63,10 @@ If you are using a PollableChannel (e.g., Queue), you can also provide ]]> -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. - + In the above example, all messages sent to the 'eventChannel' channel will be published as ApplicationEvents to any relevant + ApplicationListener instances that are registered within the same 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. +