问题
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