Project: mule
Issue MULE-6749: ReplyToHandlers do not work with Dynamic Outbound Endpoints
ReplyToHandler in the case of Ajax (AjaxReplyToHandler) depends on the MessageSourceURI to actually send the message back to the caller. If a dynamic outbound endpoint is introduced in the middle which replaces the event's MessageSourceURI it breaks the replyTo. See the following flow (modified version of the Order Processing example shipped with Studio): {code}	{code} produces the following error: {code} {"timestamp":"Wed, 20 Mar 2013 00:03:58 GMT","id":"370","data":{},"channel":"/orders/soap","clientId":"k9lc8wpz6dr1fsvppi"} java.lang.reflect.InvocationTargetException sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:597) org.mortbay.cometd.BayeuxService.doInvoke(BayeuxService.java:357) org.mortbay.cometd.BayeuxService.invoke(BayeuxService.java:309) org.mortbay.cometd.BayeuxService.access$400(BayeuxService.java:59) org.mortbay.cometd.BayeuxService$AsyncListen.deliver(BayeuxService.java:393) org.mortbay.cometd.ClientImpl.notifyMessageListener(ClientImpl.java:214) org.mortbay.cometd.ClientImpl.doDelivery(ClientImpl.java:194) org.mortbay.cometd.ChannelImpl.deliverToSubscriber(ChannelImpl.java:502) org.mortbay.cometd.ChannelImpl.doDelivery(ChannelImpl.java:464) org.mortbay.cometd.ChannelImpl.doDelivery(ChannelImpl.java:494) org.mortbay.cometd.ChannelImpl.doDelivery(ChannelImpl.java:494) org.mortbay.cometd.AbstractBayeux$PublishHandler.handle(AbstractBayeux.java:1293) org.mortbay.cometd.AbstractBayeux.handle(AbstractBayeux.java:287) org.mortbay.cometd.continuation.ContinuationCometdServlet.service(ContinuationCometdServlet.java:171) org.mule.transport.ajax.container.MuleAjaxServlet.service(MuleAjaxServlet.java:107) org.mortbay.cometd.AbstractCometdServlet.service(AbstractCometdServlet.java:265) org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401) org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230) org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) org.mortbay.jetty.Server.handle(Server.java:326) org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945) org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) Caused by: org.mule.api.MessagingException: Endpoint scheme must be compatible with the connector scheme. Connector is: "ajax", endpoint is "http://0.0.0.0:1080/orders" (java.lang.IllegalArgumentException). Message payload is of type: String org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:35) org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:46) org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43) org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:93) org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66) org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43) org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:105) org.mule.processor.AsyncInterceptingMessageProcessor.process(AsyncInterceptingMessageProcessor.java:98) org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:46) org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43) org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:93) org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66) org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43) org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:105) org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55) org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:46) org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43) org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:105) org.mule.processor.AbstractFilteringMessageProcessor.process(AbstractFilteringMessageProcessor.java:44) org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:46) org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43) org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:105) org.mule.construct.AbstractPipeline$1.process(AbstractPipeline.java:102) org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:46) org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43) org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:93) org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66) org.mule.processor.chain.InterceptingChainLifecycleWrapper.doProcess(InterceptingChainLifecycleWrapper.java:57) org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66) org.mule.processor.chain.InterceptingChainLifecycleWrapper.access$001(InterceptingChainLifecycleWrapper.java:29) org.mule.processor.chain.InterceptingChainLifecycleWrapper$1.process(InterceptingChainLifecycleWrapper.java:90) org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:46) org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43) org.mule.processor.chain.InterceptingChainLifecycleWrapper.process(InterceptingChainLifecycleWrapper.java:85) org.mule.construct.AbstractPipeline$3.process(AbstractPipeline.java:194) org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:46) org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43) org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:93) org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66) org.mule.processor.chain.InterceptingChainLifecycleWrapper.doProcess(InterceptingChainLifecycleWrapper.java:57) org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66) org.mule.processor.chain.InterceptingChainLifecycleWrapper.access$001(InterceptingChainLifecycleWrapper.java:29) org.mule.processor.chain.InterceptingChainLifecycleWrapper$1.process(InterceptingChainLifecycleWrapper.java:90) org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:46) org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43) org.mule.processor.chain.InterceptingChainLifecycleWrapper.process(InterceptingChainLifecycleWrapper.java:85) org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:46) org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43) org.mule.processor.chain.SimpleMessageProcessorChain.doProcess(SimpleMessageProcessorChain.java:47) org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66) org.mule.processor.chain.InterceptingChainLifecycleWrapper.doProcess(InterceptingChainLifecycleWrapper.java:57) org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66) org.mule.processor.chain.InterceptingChainLifecycleWrapper.access$001(InterceptingChainLifecycleWrapper.java:29) org.mule.processor.chain.InterceptingChainLifecycleWrapper$1.process(InterceptingChainLifecycleWrapper.java:90) org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27) org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:46) org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:43) org.mule.processor.chain.InterceptingChainLifecycleWrapper.process(InterceptingChainLifecycleWrapper.java:85) org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:220) org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:202) org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:194) org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:181) org.mule.transport.ajax.AjaxMessageReceiver$ReceiverService.route(AjaxMessageReceiver.java:76)	... 32 more Caused by: java.lang.IllegalArgumentException: Endpoint scheme must be compatible with the connector scheme. Connector is: "ajax", endpoint is "http://0.0.0.0:1080/orders" org.mule.endpoint.AbstractEndpointBuilder.doBuildOutboundEndpoint(AbstractEndpointBuilder.java:254) org.mule.endpoint.AbstractEndpointBuilder.buildOutboundEndpoint(AbstractEndpointBuilder.java:122) com.mulesoft.habitat.agent.endpoint.AnypointEnabledEndpointFactory.getOutboundEndpoint(AnypointEnabledEndpointFactory.java:44) org.mule.transport.ajax.AjaxReplyToHandler.processReplyTo(AjaxReplyToHandler.java:66) org.mule.routing.requestreply.AbstractReplyToPropertyRequestReplyReplier.processReplyTo(AbstractReplyToPropertyRequestReplyReplier.java:69) org.mule.routing.requestreply.AbstractReplyToPropertyRequestReplyReplier.process(AbstractReplyToPropertyRequestReplyReplier.java:45) org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)	... 104 more {code}
Story points: 8