Book Image

Spring Integration Essentials

By : CHANDAN K PANDEY
Book Image

Spring Integration Essentials

By: CHANDAN K PANDEY

Overview of this book

Table of Contents (18 chapters)
Spring Integration Essentials
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

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" 
   ...