我正在基于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