0
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 ?

Bhuvan
  • 4,028
  • 6
  • 42
  • 84
  • they are called sequentially. as good as a for loop. the body/message changes in each iteration. you can use the .log() method to figure out whats happening. – arajashe Nov 05 '13 at 08:53

1 Answers1

1

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.

Community
  • 1
  • 1
Pith
  • 3,706
  • 3
  • 31
  • 44