Chaining handlers
We have discussed quite a lot of handlers provided by Spring Integration as filters, transformers, service activators, and so on, which can be independently applied on to the message—Spring Integration further provides a mechanism to chain these handlers. A special implementation of MessageHandler
is MessageHandlerChain
, can be configured as a single message endpoint. It is a chain of other handlers, and a message received simply delegates it to the configured handlers in a predefined sequence. Let's take an example:
<int:chain input-channel="cahinedInputFeedChannel" output-channel="logChannel"> input-channel="cahinedInputFeedChannel" output-channel="logChannel"> <int:filter ref="filterSoFeedBean" method="filterFeed" throw-exception-on-rejection="true"/> <int:header-enricher> <int:header name="test" value="value"/> </int:header-enricher> <int:service-activator ref="commonServiceActivator" ...