redben
redben

Reputation: 5686

Camel Splitter, what is it worth if at the end messages are aggregated again?

Say you have this route :

from("direct:processOrders")
.process(new MultipleOrdersProcessor())
.to("direct:done")

MultipleOrdersProcessor loops through the orders and does "things"

What would be the benefit of using a splitter and having a SingleOrderProcessor instead of MultipleOrdersProcessor ?

Upvotes: 2

Views: 171

Answers (2)

techuser soma
techuser soma

Reputation: 4877

One immediate benefit is the ability to process orders in parallel, provided the use case fits parallel processing. In case of MultipleOrdersProcessor a custom implementation is required for parallel processing.

Upvotes: 2

GeorgeL
GeorgeL

Reputation: 56

I can think of two benefits

  1. If one of the "orders" fails, it would not necessarily fail your entire exchange if they had been split into multiple messages.
  2. It may be easier to unit test a SingleOrderProcessor function using an automated tool.

Upvotes: 3

Related Questions