Possibilities of parallel processing of camels

I work on Camel routes in RedHat Fuse Service Works, which has Camel 2.10.

I would like to know the differences between the following implementations:

1 / using SEDA routes

from("A") .split(body()) .to("seda:B"); from("seda:B?concurrentConsumers=4") .routeId("MySEDATestRoute") .to("C") .end(); 

2 / using parallel processing

  from("A") .split(body()) .parallelProcessing() .to("C"); 

3 / using threads

  from("A") .split(body()) .threads() .to("C"); 

From what I saw, method 3 (threads) allows you to configure the thread pool size, which seems the same as the "concurrentConsumers" of solution 1 (SEDA).

If I do not pass any parameters to the method thread, will the behavior of methods 2 and 3 be the same?

Thanks in advance,

Hi

+5
source share
2 answers

You can set the stream number to 1), 3), but 1) can still receive a message from another route, which, like from (xxx) .to ("seda: B"). 2) You need to configure the ExecutorService (or ThreadPool), otherwise parallel processing will not work the way you want.

+1
source

The following is an example of working code:

 CamelContext context = getContext(); ExecutorService service = new ThreadPoolBuilder(context).poolSize(10).maxPoolSize(150).maxQueueSize(150).build("CustomPool"); from("properties:{{file.fromLocation}}") .log("Received the file...") .split().tokenize("\n").executorService(service) .streaming() .parallelProcessing() 
0
source

Source: https://habr.com/ru/post/1206160/


All Articles