Hi Willem,
thanks for the help. I will try the camel transport for cxf.
I have checked the EndpointMessageListener code and I think the
JmsConsumer can work with InOut Exchanges. If I understand the code
correctly it reads the reply-to header and will send the message back to
the supplied queue from the incoming message. So I guess this should
work. I will try to create a running example.
I will try with the following route:
from("jms:myqueue").choice()
.when(xpath("//namespace=service1namespace")).to("cxf:local:myEndpointName")
.when(xpath("//namespace=service2namespace")).to("cxf:local:myEndpointName2")
.otherwise().to("jms:deadletterqueue")
Best regards
Christian
----
Some code from EndpointMessageListener to show the InOut handling
----
public void onMessage(final Message message) {
try {
if (LOG.isDebugEnabled()) {
LOG.debug(endpoint + " receiving JMS message: " + message);
}
Destination replyDestination = getReplyToDestination(message);
final JmsExchange exchange = createExchange(message,
replyDestination);
if (eagerLoadingOfProperties) {
exchange.getIn().getHeaders();
}
processor.process(exchange);
final JmsMessage out = exchange.getOut(false);
if (out != null && !disableReplyTo) {
sendReply(replyDestination, message, exchange, out);
}
} catch (Exception e) {
throw new RuntimeCamelException(e);
}
}
protected Destination getReplyToDestination(Message message) throws
JMSException {
// lets send a response back if we can
Destination destination = replyToDestination;
if (destination == null) {
destination = message.getJMSReplyTo();
}
return destination;
}
Willem Jiang schrieb:
Hi Christian,
The default exchange pattern of camel-cxf component is InOut, but for
the camel-jms consumer it just receive message from message queue.
If you want send the response message back , you have to put the
message to the response queue, just like this
from("jms:myqueue").choice()
.when(xpath("//namespace=service1namespace")).to("cxf:mybeanname:myEndpointName").to("jms:responsequeue")
.when(xpath("//namespace=service2namespace")).to("cxf:mybeanname2:myEndpointName2").to("jms:responsequeue")
.otherwise().to("jms:deadletterqueue")
BTW, If you alway want to let CXF take care of the service publishing
work, you could use camel transport which will be more effective than
the local transport.
Here are the example[1] and document[2]
[1]http://cwiki.apache.org/CAMEL/cxf-example.html
[2]http://cwiki.apache.org/CAMEL/camel-transport-for-cxf.html
Willem
Christian Schneider wrote: