Class MessageHandlerChain

All Implemented Interfaces:
org.reactivestreams.Subscriber<Message<?>>, Aware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, ApplicationContextAware, Lifecycle, Ordered, ExpressionCapable, Orderable, MessageProducer, CompositeMessageHandler, HeaderPropagationAware, IntegrationPattern, NamedComponent, IntegrationManagement, ManageableLifecycle, TrackableComponent, MessageHandler, reactor.core.CoreSubscriber<Message<?>>

public class MessageHandlerChain extends AbstractMessageProducingHandler implements CompositeMessageHandler, ManageableLifecycle
A composite MessageHandler implementation that invokes a chain of MessageHandler instances in order.

Each of the handlers except for the last one must implement the MessageProducer interface. The last handler must also if the chain itself has an output channel configured. No other assumptions are made about the type of handler.

It is expected that each handler will produce reply messages and send them to its output channel, although this is not enforced. It is possible to filter messages in the middle of the chain, for example using a MessageFilter. A MessageHandler returning null will have the same effect, although this option is less expressive.

This component can be used from the namespace to improve the readability of the configuration by removing channels that can be created implicitly.

 
 <chain>
     <filter ref="someFilter"/>
     <bean class="SomeMessageHandlerImplementation"/>
     <transformer ref="someTransformer"/>
     <aggregator ... />
 </chain>
 
 
Author:
Mark Fisher, Iwein Fuld, Gary Russell, Artem Bilan, Trung Pham, Christian Tzolov