Chapter 7. Splitting and aggregating messages

 

This chapter covers

  • Splitting messages into parts
  • Aggregating messages into a composite
  • Reordering messages with a resequencer
  • Customizing aggregation

Previous chapters explained how a single message is processed as a unit. You saw channels, endpoints such as service activators and transformers, and routing. All these components have one thing in common: they don’t break the unit of the message. If one message goes in, either one message comes out the other end or it is gone forever. This chapter looks at situations in which this rule no longer holds. In some situations, one message goes in and several messages come out (splitter), and in others, several messages go in before messages start coming out (aggregator, resequencer). Examples of endpoints illustrating the various possible scenarios are shown in figure 7.1.

Figure 7.1. Examples of endpoints processing a message in one-to-one, one-to-many, and many-to-one scenarios

7.1. Introducing correlation

7.2. Splitting, aggregating, and resequencing

7.3. Useful patterns

7.4. Under the hood

7.5. Summary