Khaled
Khaled

Reputation: 654

Camel Splitter Order of Processing

If I DON'T specify parallelProcessing() when I'm splitting a List in camel, will Camel process the items in order?

Upvotes: 1

Views: 741

Answers (2)

Darrell Burk
Darrell Burk

Reputation: 21

Ralf's answer addresses the order of aggregation, but the OP's question is about the order of processing. Those two orders don't have to be the same.

The Camel documentation doesn't seem to answer this question directly.

Based on the docs, I think the following can be inferred

  • when parallelProcessing is not used:

    • when streaming is not used (in this case the list is split completely before any items are processed) the order of execution depends on the element ordering in the structure that holds the split list. The type of this structure is not documented. We should not assume that the original message order of the list items will be preserved in this structure. Therefore, it is not safe to assume the items will be processed in the same order as they appear within the input message.
    • when streaming is used, the input message will be split one item at a time and that item will be processed before the next item is split from the the input message. Here it is safer to assume that the items will be executed in the same order as those items are encountered in the input message. This is not a contract, though; just a safer assumption.
  • when parallelProcessing is used, the question itself is moot; all the items will be processed simultaneously. This is a contract.

Upvotes: 0

Ralf
Ralf

Reputation: 6853

According to the documentation you also have to set streaming=false to guarantee in-order aggregation.

Upvotes: 1

Related Questions