apache camel - seda 端点多播 [英] apache camel - seda endpoint multicast

查看:37
本文介绍了apache camel - seda 端点多播的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

该计划是让 process1 和 process2 并行运行,并使其输出在连接端点上可用.如果在direct"上,上面的工作正常,但在seda"上,行为是join"被立即调用,即使 process1 和 process2 仍在进行中.

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")

现在运行正常(我可以在连接端点上检索 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 使用 multicastparalellProcessing 将负责并行运行这些进程.

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 端点多播的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆