有沒有什麼辦法來路由通過操作該消息中指定的ServiceMix的消息?路由通過操作
我試過Google搜索它,但無法找到任何方法來完成這個簡單的任務,也許我做錯了第一位?
我已經得到了調度2種消息類型的適配器。 2個其他適配器必須趕上他們,並作出迴應。這兩個消息具有相同的主體(例如讓它成爲一些<product>...</product>
),但操作不同(例如update
和create
)。我如何路由消息不同的適配器?
在此先感謝。
有沒有什麼辦法來路由通過操作該消息中指定的ServiceMix的消息?路由通過操作
我試過Google搜索它,但無法找到任何方法來完成這個簡單的任務,也許我做錯了第一位?
我已經得到了調度2種消息類型的適配器。 2個其他適配器必須趕上他們,並作出迴應。這兩個消息具有相同的主體(例如讓它成爲一些<product>...</product>
),但操作不同(例如update
和create
)。我如何路由消息不同的適配器?
在此先感謝。
找到答案在這裏: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"));
}
}
使用Camel XPath謂詞(http://camel.apache.org/xpath.html)。例如:
from("queue:products").
choice().xpath("/product/[@create='true']")).to("queue:create").
otherwise().to("queue:update");
很抱歉,但我的意思是我的對象JBI運行時,而不是一些自定義的操作。 – bezmax 2011-04-19 06:36:45