1
votes

My flow is necessary to use the component request-reply twice, but when I try to do the following problem:

    <flow name="myprojectFlow">
        <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
        <request-reply doc:name="RR1">
            <jms:outbound-endpoint queue="req_queue" doc:name="JMS" connector-ref="Active_MQ">
                <jms:transaction action="ALWAYS_BEGIN"/>
            </jms:outbound-endpoint>
            <jms:inbound-endpoint queue="rep_queue" doc:name="JMS" connector-ref="Active_MQ">
                <jms:transaction action="ALWAYS_BEGIN"/>
            </jms:inbound-endpoint>
        </request-reply>
        <request-reply doc:name="RR2">
            <jms:outbound-endpoint queue="req_queue" doc:name="JMS" connector-ref="Active_MQ">
                <jms:transaction action="ALWAYS_BEGIN"/>
            </jms:outbound-endpoint>
            <jms:inbound-endpoint queue="rep_queue" doc:name="JMS" connector-ref="Active_MQ">
                <jms:transaction action="ALWAYS_BEGIN"/>
            </jms:inbound-endpoint>
        </request-reply>
    </flow>

Another system receives a message from req_queue and send into rep_queue.

Error:

ERROR 2015-10-07 19:48:41,703 [main] org.mule.module.launcher.application.DefaultMuleApplication: null
org.mule.api.transport.ConnectorException: There is already a listener registered on this connector on endpointUri: jms://rep_queue. Connector that caused exception is: ActiveMQJmsConnector
{
  name=Active_MQ
  lifecycle=start
  this=75361cf6
  numberOfConcurrentTransactedReceivers=4
  createMultipleTransactedReceivers=true
  connected=true
  supportedProtocols=[jms]
  serviceOverrides=<none>
}

    at org.mule.transport.AbstractConnector.registerListener(AbstractConnector.java:1258) ~[mule-core-3.7.0.jar:3.7.0]
    at org.mule.endpoint.DefaultInboundEndpoint.start(DefaultInboundEndpoint.java:104) ~[mule-core-3.7.0.jar:3.7.0]
    at org.mule.routing.requestreply.SimpleAsyncRequestReplyRequester.start(SimpleAsyncRequestReplyRequester.java:87) ~[mule-core-3.7.0.jar:3.7.0]
    at org.mule.processor.chain.AbstractMessageProcessorChain.start(AbstractMessageProcessorChain.java:102) ~[mule-core-3.7.0.jar:3.7.0]
    at org.mule.construct.AbstractFlowConstruct.startIfStartable(AbstractFlowConstruct.java:325) ~[mule-core-3.7.0.jar:3.7.0]
    at org.mule.construct.AbstractPipeline.doStart(AbstractPipeline.java:351) ~[mule-core-3.7.0.jar:3.7.0]
    at org.mule.construct.Flow.doStart(Flow.java:90) ~[mule-core-3.7.0.jar:3.7.0]
    at org.mule.construct.AbstractFlowConstruct$2.onTransition(AbstractFlowConstruct.java:136) ~[mule-core-3.7.0.jar:3.7.0]

How can I use the request-reply with the same JMS queue twice in one flow?

1

1 Answers

0
votes

Are your sure about JMS queues your pointing? I can see your sending message to "req_queue" and pointing to the "rep_queue" to receive message. you will never get the message there from "rep_queue". I have modified slightly and worked from me. let me know if it's not fulfill your requirement...

<flow name="myprojectFlow">
<http:listener config-ref="HTTP_Listener_Configuration1" path="/" doc:name="HTTP"/>
<set-payload doc:name="Set Payload" value="Hi"/>
<request-reply doc:name="RR1">
    <jms:outbound-endpoint queue="req_queue" doc:name="JMS" connector-ref="Active_MQ">
        <jms:transaction action="ALWAYS_BEGIN"/>
    </jms:outbound-endpoint>
    <jms:inbound-endpoint queue="req_queue" doc:name="JMS" connector-ref="Active_MQ">
        <jms:transaction action="ALWAYS_BEGIN"/>
    </jms:inbound-endpoint>
</request-reply>
<logger message="---- payload ---#[payload]" level="INFO" doc:name="Logger"/>
<request-reply doc:name="RR2">
    <jms:outbound-endpoint queue="req_queue1" doc:name="JMS" connector-ref="Active_MQ">
        <jms:transaction action="ALWAYS_BEGIN"/>
    </jms:outbound-endpoint>
    <jms:inbound-endpoint queue="req_queue1" doc:name="JMS" connector-ref="Active_MQ">
        <jms:transaction action="ALWAYS_BEGIN"/>
    </jms:inbound-endpoint>
</request-reply>
<logger message="---- payload1 ---#[payload]" level="INFO" doc:name="Logger"/>