在camel中,是否有可能为n个路由创建多播,并从n个路由中选择最快的一个来决定整个多播的单个聚合值?
例如:
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调用一次。
不知何故,聚合无法看到多播路由内部的报头更改,或者聚合谓词是错误的?
发布于 2019-03-19 02:46:15
似乎没有一个camel组件(拆分、多播)支持正常的程序中断,因此应该创建路由分解,并在外部帮助下手动聚合它们。例如,Map存储/获取结果
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 /
https://stackoverflow.com/questions/55212283
复制相似问题