你能从另一条路线增加一条 Apache Camel 多播路线的消息吗
Can you augment the messages for one of the Apache Camel multicast routes from another route
我正在实施客户添加方案。输入是客户对象,需要发送到一个 jms 队列以创建客户,然后依次发送到另一个队列以使用第一个系统不支持的一些字段更新客户。两个系统之间存在后台同步,因此在我发送更新请求时客户已经存在于 system2 中。我现在遇到的问题是我需要从 system1 响应中提取客户 ID,并用它来增加 system2 的客户对象。路线应该 return 该客户 ID。在 Camel 中正确的做法是什么?
这就是我现在拥有的:
from("direct:customerUpdate)
.multicast(new AggregationStrategy() {
@Override
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
if (oldExchange == null) {
return newExchange;
}
return oldExchange;
}
})
.stopOnException()
.to("direct:addCustomerSystem1", "direct:updateCustomerSystem2")
.end();
addCustomerSystem1 returns 客户 ID,但这不会增加 updateCustomerSystem2 的客户对象。
不使用多播,只使用普通的(例如管道和过滤器)或内容丰富器。后者允许您在发送到 system2 之前增加来自 system1 的响应。
我正在实施客户添加方案。输入是客户对象,需要发送到一个 jms 队列以创建客户,然后依次发送到另一个队列以使用第一个系统不支持的一些字段更新客户。两个系统之间存在后台同步,因此在我发送更新请求时客户已经存在于 system2 中。我现在遇到的问题是我需要从 system1 响应中提取客户 ID,并用它来增加 system2 的客户对象。路线应该 return 该客户 ID。在 Camel 中正确的做法是什么?
这就是我现在拥有的:
from("direct:customerUpdate)
.multicast(new AggregationStrategy() {
@Override
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
if (oldExchange == null) {
return newExchange;
}
return oldExchange;
}
})
.stopOnException()
.to("direct:addCustomerSystem1", "direct:updateCustomerSystem2")
.end();
addCustomerSystem1 returns 客户 ID,但这不会增加 updateCustomerSystem2 的客户对象。
不使用多播,只使用普通的(例如管道和过滤器)或内容丰富器。后者允许您在发送到 system2 之前增加来自 system1 的响应。