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

Splitters


Splitters, as the name suggests, are used to split messages in smaller chunks and then send such resulting chunks for independent processing. There can be several reasons for splitting—larger size of payload than that of what is acceptable by the next endpoint, or message load parts that can be processed in parallel or down the chain. There is an aggregator and it is necessary to do some processing before these can be aggregated. Spring Integration provides a splitter tag. As in the case of a filter, splitters can also be written either by extending the framework interface or by writing a custom POJO.

Let's take the simpler one first, leveraging a simple Java class as a splitter:

<int:splitter
  ref="splitterSoFeedBean" 
  method="splitAndPublish" 
  input-channel="filteredFeedChannel" 
  output-channel="splitFeedOutputChannel" />


<bean id="splitterSoFeedBean" 
  class="com.cpandey.siexample.splitter.SoFeedSplitter"/>

The elements are pretty self-explanatory:

  • int:splitter...