问题描述
from("seda:start)
.multicast(new GroupedBodyAggregationStrategy())
.parallelProcessing()
.to("seda:process1", "seda:process2")
.end()
.to("seda:join");
该计划是让 process1 和 process2 并行运行,并使其输出在连接端点上可用.如果在直接"上,上面工作正常,但在seda"上,行为是即使 process1 和 process2 仍在进行中,也会立即调用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.
我尝试将以下选项添加到 process1 和 process2:
I have tried adding the following options to process1 and process2:
to("seda:process1?waitForTaskToComplete=Always", "seda:process2?waitForTaskToComplete=Always")
它现在运行正常(我可以在 join 端点上检索 process1 和 process2 输出)但是整个请求链正在排队并且没有并行运行.例如,我在开始"端点上并行发送了两条消息,只有在另一条完整链完成后才会触发一条完整链.
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.
有什么想法吗?
推荐答案
你可以让 start 和 join 组件使用 seda
.而 process1 和 process2 使用 multicast
和 parallellProcessing
这将负责并行运行这些进程.
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.
对于 seda:start
使用类似的东西,
And for the seda:start
use something like,
from("seda:start?concurrentConsumers=10")
这将开始并行接受 10 个请求.有关更多信息,请查看 http://camel.apache.org/seda.html一个>
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
这篇关于apache camel - seda 端点组播的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!