有没有办法通过消息中指定的操作来路由ServiceMix消息?
我试着用谷歌搜索它,但找不到任何方法来完成这个简单的任务,也许我一开始就做错了?
我有一个适配器,可以分派两种类型的消息。2其他适配器必须捕获它们并给出响应。这两个消息具有相同的正文(例如,假设它是某个<product>...</product>),但操作不同(例如,update和create)。如何将消息路由到不同适配器?
提前谢谢。
发布于 2011-04-19 14:38:22
在这里找到了答案:http://fernandoribeiro.eti.br/2009/06/06/multiple-operations-in-apache-camel-routes/
import org.apache.camel.builder.RouteBuilder;
public final class SampleRouteBuilder extends RouteBuilder {
public void configure() {
from("jbi:service:http://www.fernandoribeiro.eti.br/SampleService")
.choice()
.when(header("jbi.operation")
.isEqualTo("{http://www.fernandoribeiro.eti.br}FirstOperation"))
.when(header("jbi.operation")
.isEqualTo("{http://www.fernandoribeiro.eti.br}SecondOperation"));
}
}发布于 2011-04-18 20:10:18
使用驼峰XPath谓词(http://camel.apache.org/xpath.html)。例如:
from("queue:products").
choice().xpath("/product/[@create='true']")).to("queue:create").
otherwise().to("queue:update");https://stackoverflow.com/questions/5701281
复制相似问题