Bhuvan
Bhuvan

Reputation: 4177

understand split behavior in apache camel

from("direct:A")
    .split(//expression that split msg into two msg M1,M2)
          .process(// here processing)

.from("direct:A") behaves like a java method i.e the thread that calls it will continue to split.

So what will happen in above case ?

Ley say Thread t1 calls from("direct:A") then

It enters into .split() here the msg is divided into two new messages M1 and M2.

Now from here on-wards will t1 call process() for M1 and M2 synchronously ?

or

process() will be called for M1 and M2 in two new thread asynchronously ?

Upvotes: 0

Views: 2610

Answers (1)

Pith
Pith

Reputation: 3794

By default the process() method is called sequentially. But you can activate parallel processing by adding an option.

From the Camel doc:

parallelProcessing (default false): If enabled then processing the sub-messages occurs concurrently. Note the caller thread will still wait until all sub-messages has been fully processed, before it continues.

NB: If you are interested in splitter's performance, you can look for the streaming option.

Upvotes: 1

Related Questions