Description
In all current releases, org.apache.camel.component.jms.EndpointMessageListener.onMessage() has the following logic (line 90 in 1.6.0 code):
// send the reply if (rce == null && body != null && !disableReplyTo) { sendReply(replyDestination, message, exchange, body); }
This logic should also respect ExchangePattern of the exchange, so I propose a change to:
// send the reply if (rce == null && body != null && exchange.isOutCapable()) { sendReply(replyDestination, message, exchange, body); }
This change allows a processing pattern where the route may change the ExchangePattern using methods like RouteBuilder.inOnly() to switch the MEP at will so that the reply is send at a later time (true asynchronous exchange). This processing pattern is particularly useful for integrating long running services. For example,
// Java DSL from("activemq:my_queue?exchangePattern=InOnly").to("predict_weather://?reply_later=true"); // or from("activemq:my_queue2").inOnly().to("predict_weather://?reply_later=true");
The flaw of the current logic makes it impossible to do true asynchronous exchange, because 1) it does not respect the ExchangePattern; 2) if property "disableReplyTo" is used, the "org.apache.camel.jms.replyDestination" property will not be set (see method createExchange in the same file), thus downstream cannot find the reply destination.
The proposed change can also deprecate the disableReplyTo property and put the MEP concept into good use.
Attachments
Issue Links
- depends upon
-
CAMEL-1384 ExchangeHelper should respect ExchangePattern.InOptionalOut
- Closed
-
CAMEL-1405 be able to create a jms endpoint easily from a JMS Destination object - as well as to be able to use a property on an Exchange to denote the real JMS destination to send a message to
- Closed