Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Won't Fix or Usage Issue
-
Affects Version/s: 2.0.1
-
Fix Version/s: None
-
Component/s: Core: Routing / Filters, Transport: JMS
-
Labels:None
-
User impact:Medium
-
Effort points:2
-
Affects Docs:Yes
-
Migration Impact:ReplyTo scenarios need more documentation
-
Similar Issues:None
Description
I just found a case where replyTo is not working (for JMS at least). Consider the following:
<model> <service name="In-Optional-Out_Out-Optional-In-Service"> <inbound> <vm:inbound-endpoint ref="inboundEndpoint"/> </inbound> <script:component> <script:script engine="groovy"> if (message.getProperty("foo") != null) { message.setProperty("bar", "baz") return message } else return message </script:script> </script:component> <outbound> <outbound-pass-through-router> <outbound-endpoint ref="ExternalEndpoint" remoteSync="true"/> <!-- Mule will automatically listen n this destination when Remote sync is set. If this is not se a temprary destination is set up --> <reply-to address="jms://reply"/> </outbound-pass-through-router> </outbound> </service> <service name="Mock-External-App"> <inbound> <inbound-endpoint ref="ExternalEndpoint"/> </inbound> <script:component> <script:script engine="groovy"> message.setProperty("externalApp", "Received") if (message.getProperty("bar") != null) return "bar header received" else return null </script:script> </script:component> </service> </model>
I set the replyTo on the first component and I set remoteSync="true". This should create/listen on a jms destination "reply", but doesn't.
It does work if REPLY-TO is NOT set but remoteSync=true is i.e. temporary destination.
Looking at the code, ReplyTo only works if the JMS_ReplyTo header is set no the MULE_REPLY_TO. In the JmsMessageDispatcher, it seems we need something like:
Object tempReplyTo = eventMsg.removeProperty(JmsConstants.JMS_REPLY_TO); if(tempReplyTo==null) { //It may be a Mule URI or global endpoint Ref tempReplyTo = eventMsg.removeProperty(MuleProperties.MULE_REPLY_TO_PROPERTY); if(tempReplyTo!=null) { if(tempReplyTo.toString().startsWith("jms://")) { tempReplyTo = tempReplyTo.toString().substring(6); } else { EndpointBuilder epb = event.getMuleContext().getRegistry().lookupEndpointBuilder(tempReplyTo.toString()); if(epb != null) { tempReplyTo = epb.buildOutboundEndpoint().getEndpointURI().getAddress(); } } }
But adding this causes some odd behaviour in my test case. Now when <Reply-To> is set the test fails because the the session gets closed.