首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >具有最快路由制胜能力的Camel组播聚合

具有最快路由制胜能力的Camel组播聚合
EN

Stack Overflow用户
提问于 2019-03-18 05:51:01
回答 1查看 170关注 0票数 0

在camel中,是否有可能为n个路由创建多播,并从n个路由中选择最快的一个来决定整个多播的单个聚合值?

例如:

代码语言:javascript
运行
复制
from("direct:anywhere")
  .process(e -> { e.getIn().setHeader("isComplete", false)})
  .multicast()
    .parallelProcessing(true)
    .to("direct:somewhere", "direct:somewhere2")
    .end()
  .aggregate(header("isComplete"))
    .completion(header("isComplete").isEqualTo(true))
    .completionSize(1); // do i need this at all if i want the fastest route?
  .choice()..... // based on the fastest route's logic do something else with the exchange.getIn() headers or body

我对多播和聚合都尝试了aggregationStrategies,但它们甚至不会使用空oldExchange调用一次。

不知何故,聚合无法看到多播路由内部的报头更改,或者聚合谓词是错误的?

EN

回答 1

Stack Overflow用户

发布于 2019-03-19 02:46:15

似乎没有一个camel组件(拆分、多播)支持正常的程序中断,因此应该创建路由分解,并在外部帮助下手动聚合它们。例如,Map存储/获取结果

代码语言:javascript
运行
复制
R1 (multicast to seda routes) -> R2 (timeout logic) -> R4 - get results from a Map(either R2 timeouted or R3 put there something faster) 
   \                                                  ^     should be threadsafe
    \                                                /  
     ˇ  R3 quickly found a result for the problem   /
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55212283

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档