我正在使用 Camel JMS 组件进行请求-回复以与 MQ 进行通信。对于我的一些请求,我可以收到n条回复消息。如何汇总这些回复消息?
我想过使用聚合器模式和聚合策略,但不能使用它,因为我不确定可以回复的消息数量。
社区可以帮助我了解正确的方法吗?我做了一些谷歌搜索,但找不到有用的东西。以下是我的示例路线代码
from("direct:"+routeName).routeId(routeName)
.setHeader("JMSCorrelationID", constant(UUID.randomUUID().toString()))
.circuitBreaker()
.resilience4jConfiguration()
.minimumNumberOfCalls(3)
.end()
.to(mqComponentBeanName+"://CAMELDEMO?exchangePattern=InOut&requestTimeout=10000&replyTo=CAMELDEMOREPLY")
.log("${body}")
.unmarshal(customerDetailsOutBound)
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
System.out.println(exchange.getIn().getBody().toString());
}
})
.onFallback().process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
System.out.println("Store this message to backup");
}
})
.end();
期待从社区中获得一些好的见解。谢谢你。