apache camel - seda endpoint multicast

断了今生、忘了曾经 提交于 2019-12-11 17:16:36

问题


from("seda:start)
.multicast(new GroupedBodyAggregationStrategy())
      .parallelProcessing()
      .to("seda:process1", "seda:process2")
      .end()
   .to("seda:join");

The plan is for process1 and process2 to run in parallel and for its output to be available on join endpoint. Above is working fine if on "direct", but on "seda" the behavior is that the "join" is getting invoked immediately even though process1 and process2 is still in progress.

I have tried adding the following options to process1 and process2:

to("seda:process1?waitForTaskToComplete=Always", "seda:process2?waitForTaskToComplete=Always")

It is now behaving okay (I can retrieve process1 and process2 outputs on join endpoint) but one whole chain of request is getting queued and not running in parallel. Example, I have sent two messages in parallel on "start" endpoint, one whole chain is getting triggered only after having the other the other full chain is completed.

Any ideas?


回答1:


You can make the start and join component use seda. whereas the process1 and process2 uses multicast with paralellProcessing which will take care of running these process in parallel.

And for the seda:start use something like,

from("seda:start?concurrentConsumers=10") this will start accepting 10 requests in parallel. For more information, please take a look at http://camel.apache.org/seda.html



来源:https://stackoverflow.com/questions/57087489/apache-camel-seda-endpoint-multicast

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!