Chapter 5. Splitting and Aggregating

In this chapter, we will cover:

  • Splitting a message into fragments
  • Splitting XML messages
  • Processing split messages in parallel
  • Aggregating related messages
  • Aggregating with timeouts
  • Aggregating with intervals
  • Processing aggregated messages in parallel
  • Splitting a message, and processing and gathering responses
  • Splitting messages and re-aggregating them using different criteria

Introduction

This chapter will describe how to split exchanges into smaller fragments and process them individually. It will also explain how you can aggregate (join) multiple exchanges by grouping them according to arbitrary expressions. Finally, it will discuss how to split messages into fragments, process them individually, and re-aggregate the results; either back into the original exchange, or into a new combination of exchanges.

None of these operations are as straightforward as might be considered at first glance. The combination of options that you select alters behaviors such as error handling and threading quite substantially. The following recipes will explain some of these edge cases.

A number of Camel architectural concepts are used throughout this chapter. There is a broader overview of Camel concepts in the Preface. Full details can be found on the Apache Camel website at http://camel.apache.org.

The code for this chapter is contained within the camel-cookbook-split-join module of the examples.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.202.177