我正在基於webservice和jms隊列的駱駝動態路由管理器。我有這個以下結構:駱駝動態路由不轉發郵件
endpoint:cxf -> jms:queue -> dynamic routing to a jms:queue -> processing
這裏是我的路由定義:
@Override
public void configure() throws Exception {
routeDefinition = from(fromEndpoint).routeId(name)
.dynamicRouter(method(DynamicRoutingManager.class, "getRoute")).process(exchange -> {
final List<?> soaList = exchange.getIn().getBody(List.class);
final String type = (String) soaList.get(0);
final String documentNumber = (String) soaList.get(1);
final String productionStepNumber = (String) soaList.get(2);
final String message = (String) soaList.get(3);
final String messageToSend = "Route ID=" + name + ", from=" + fromEndpoint + ", type=" + type
+ ", document number=" + documentNumber + ", production step number" + productionStepNumber
+ ", message=" + message;
LOG.debug("==> message={}", messageToSend);
exchange.getOut().setBody(messageToSend);
}); // .to(DLQ);
}
,在這裏我的動態路由管理器(保持簡單):
public String getRoute(String body, @Header(Exchange.SLIP_ENDPOINT) String previous) {
LOG.debug("========> BODY={}", body);
return "jms:topic:urgent_doc1_prod1";
}
路線jms:topic:urgent_doc1_prod1
在運行時定義並運行(在日誌中查看)
事實是wh恩我送一個這樣的請求(見下文),我收到了超時錯誤......
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hel="http://cxf.apache.org/wsse/handler/helloworld">
<soapenv:Header/>
<soapenv:Body>
<hel:message>
<!--Optional:-->
<type>urgent</type>
<!--Optional:-->
<document_number>1</document_number>
<!--Optional:-->
<production_step_number>1</production_step_number>
<!--Optional:-->
<message>un message</message>
</hel:message>
</soapenv:Body>
</soapenv:Envelope>
因爲我覺得我的消息不forwared到第二JMS:隊列,所以可以做任何處理...
我做錯了什麼?
感謝您的回答,但它不起作用。郵件列入'jms:topic:urgent_doc1_prod1',但從未出列並以DLQ結尾.. – ggwtf
我不想問您的問題。您是否正在通過JMS進行某種請求/回覆,並希望駱駝在繼續之前等待回覆消息。 –
我使用用戶界面在運行時動態創建路由,動態部分用於根據這些動態路由轉發消息(根據請求中定義的選項)。最後,目前,我只想發送一個處理過的消息(包含最初請求的內容) – ggwtf