diff --git a/spring-integration-reference/reference/src/adapters.xml b/spring-integration-reference/reference/src/adapters.xml index 4d5a248ee3..91eeb24534 100644 --- a/spring-integration-reference/reference/src/adapters.xml +++ b/spring-integration-reference/reference/src/adapters.xml @@ -9,8 +9,8 @@ are external to the messaging system. As the name implies, the interaction consists of adapting the external system or component to send-to and/or receive-from a MessageChannel. Within Spring Integration, there is a distinction between source adapters and target - adapters. In the 1.0 Milestone 1 release, Spring Integration includes adapters for JMS, Files, - Streams, and Spring ApplicationEvents. + adapters. In the 1.0 Milestone 2 release, Spring Integration includes source and target adapters + for JMS, Files, Streams, and Spring ApplicationEvents as well as a target adapter for sending e-mail. @@ -60,8 +60,9 @@ The JmsTargetAdapter is a MessageHandler implementation that is capable of mapping Spring Integration Messages to JMS messages and then sending to a JMS destination. It requires either a 'jmsTemplate' reference or both 'connectionFactory' and - 'destination' references. In , you will see how to configure a JMS target - adapter with Spring Integration's namespace support. + 'destination' references (again, the 'destinationName' may be provided in place of the 'destination). In + , you will see how to configure a JMS target adapter with Spring + Integration's namespace support.
@@ -117,8 +118,8 @@ To send Spring ApplicationEvents, register an instance of the ApplicationEventTargetAdapter class as the handler of an endpoint (such configuration will be described in detail in ). This adapter implements Spring's - ApplicationEventPublisherAware and thus acts as a bridge between Spring - Integration Messages and ApplicationEvents. + ApplicationEventPublisherAware interface and thus acts as a bridge between + Spring Integration Messages and ApplicationEvents.
\ No newline at end of file diff --git a/spring-integration-reference/reference/src/configuration.xml b/spring-integration-reference/reference/src/configuration.xml index dede8d7fb6..e6d89e098a 100644 --- a/spring-integration-reference/reference/src/configuration.xml +++ b/spring-integration-reference/reference/src/configuration.xml @@ -88,6 +88,28 @@ should-fail-on-rejection-limit="false"/> ]]> + + To create a Datatype Channel that only + accepts messages containing a certain payload type, provide the fully-qualified class name in the + channel element's datatype attribute: + ]]> + Note that the type check passes for any type that is assignable to the channel's + datatype. In other words, the "numberChannel" above would accept messages whose payload is + java.lang.Integer or java.lang.Double. Multiple types can be + provided as a comma-delimited list: + ]]> + + + Message channels may also have interceptors as described in . One or + more <interceptor> elements can be added as sub-elements of <channel>. Provide the "ref" attribute + to reference any Spring-managed object that implements the ChannelInterceptor + interface: + + +]]> + In general, it is a good idea to define the interceptors in a separate location since they usually provide + common behavior that can be reused across multiple channels. +
diff --git a/spring-integration-reference/reference/src/core-api.xml b/spring-integration-reference/reference/src/core-api.xml index beb4fd864f..b633f535c3 100644 --- a/spring-integration-reference/reference/src/core-api.xml +++ b/spring-integration-reference/reference/src/core-api.xml @@ -128,6 +128,45 @@ new GenericMessage<T>(T payload, MessageHeader headerToCopy)
+
+ ChannelInterceptor + + One of the advantages of a messaging architecture is the ability to provide common behavior and capture + meaningful information about the messages passing through the system in a non-invasive way. Since the + Messages are being sent to and received from + MessageChannels, those channels provide an opportunity for intercepting + the send and receive operations. The ChannelInterceptor strategy interface + provides methods for each of those operations: + message, MessageChannel channel); + void postSend(Message message, MessageChannel channel, boolean sent); + boolean preReceive(MessageChannel channel); + void postReceive(Message message, MessageChannel channel); +}]]> + After implementing the interface, registering the interceptor with a channel is just a matter of calling: + channel.addInterceptor(someChannelInterceptor); + The methods that return a boolean value can return 'false' to prevent the + send or receive operation from proceeding (send would return 'false' and receive would return 'null'). + + + Because it is rarely necessary to implement all of the interceptor methods, a + ChannelInterceptorAdapter class is also available for sub-classing. It provides no-op + methods (the void methods are empty, and the boolean methods return + true). Therefore, it is often easiest to extend that class and just implement the method(s) + that you need as in the following example. + message, MessageChannel channel) { + sendCount.incrementAndGet(); + return true; + } +}]]> + +
+
MessageHandler