« Return to Thread: JMS Reply To Issue

JMS Reply To Issue

by Richard Holt :: Rate this Message:

Reply to Author | View in Thread

Hi,

I have spent the last few days investigating an issue with JMS and ReplyTo. Just a little background, we are using 2 JMS brokers, one local and one remote and we were seeing issues whereby an error was raised where a Mule consuming from the remote queue was trying to respond to a Temporary Reply To set on the producing Mule system. This is running Mule 2.1.1 and Active MQ 5.1.0.

My conclusion is that the following is happening :

Mule Server A published to a queue using remoteSync = true. This sets the JMSReplyTo header on the message.
Mule Server B sees the JMSReplyTo and treats this as requiring a response and instantiates the JMSReplyToHandler. In the meantime however on Mule Server A the consumer.receive in the JMSMessageDispatcher has consumed from the temporary JMS queue and deleted the temporary queue. Mule Server B will then continue and write to the temporary queue which has been deleted.

Here is a test configuration file that shows the problem. Also i have included the code for the JmsRecipientList below.

To get this test to work you have to put the JmsReplyToHandler.java into your code and either put a breakpoint into it or a timer at the start of "processReplyTo" which halts the system for longer than 3 seconds!!

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.1"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:spring="http://www.springframework.org/schema/beans"
        xmlns:jms="http://www.mulesource.org/schema/mule/jms/2.1"
        xmlns:jbossts="http://www.mulesource.org/schema/mule/jbossts/2.1"
        xmlns:file="http://www.mulesource.org/schema/mule/file/2.1"
        xmlns:management="http://www.mulesource.org/schema/mule/management/2.1"
        xmlns:context="http://www.springframework.org/schema/context"
        xsi:schemaLocation="http://www.mulesource.org/schema/mule/core/2.1 http://www.mulesource.org/schema/mule/core/2.1/mule.xsd
                http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.1.xsd
                http://www.mulesource.org/schema/mule/jms/2.1 http://www.mulesource.org/schema/mule/jms/2.1/mule-jms.xsd
                http://www.mulesource.org/schema/mule/management/2.1 http://www.mulesource.org/schema/mule/management/2.1/mule-management.xsd
                http://www.mulesource.org/schema/mule/jbossts/2.1 http://www.mulesource.org/schema/mule/jbossts/2.1/mule-jbossts.xsd   
                http://www.mulesource.org/schema/mule/file/2.1 http://www.mulesource.org/schema/mule/file/2.1/mule-file.xsd">
               
        <file:connector name="fileConnector" autoDelete="true" streaming="false"/>

        <jms:activemq-connector name="localJmsConnector"
                acknowledgementMode="AUTO_ACKNOWLEDGE" recoverJmsConnections="true" persistentDelivery="true">
        </jms:activemq-connector>

        <model name="testModel">
                <service name="testService">
                  <inbound>
                    <file:inbound-endpoint path="c:/data/in" moveToDirectory="c:/save"/>
                  </inbound>
                  <outbound>
                        <custom-outbound-router class="com.acme.JmsRecipientList"/>
                  </outbound>
                </service>

                <service name="testService2">
                  <inbound>
                    <jms:inbound-endpoint queue="test2.queue" connector-ref="localJmsConnector"/>
                  </inbound>
                  <outbound>
                  <pass-through-router>
                                <file:outbound-endpoint path="c:/data/out2" connector-ref="fileConnector"/>
                  </pass-through-router>
                  </outbound>
                </service>

                <service name="testService3">
                  <inbound>
                    <jms:inbound-endpoint queue="test3.queue" connector-ref="localJmsConnector"/>
                  </inbound>
                  <outbound>
                  <pass-through-router>
                                <file:outbound-endpoint path="c:/data/out3" connector-ref="fileConnector"/>
                  </pass-through-router>
                  </outbound>
                </service>
        </model>
</mule>

JmsRecipientList.java

package com.acme;

import java.util.ArrayList;
import java.util.List;

import org.mule.api.MuleMessage;
import org.mule.routing.outbound.AbstractRecipientList;

public class JmsRecipientList extends AbstractRecipientList {

        @Override
        protected List<?> getRecipients(MuleMessage muleMessage) {
                List<String> result = new ArrayList<String>();
               
                result.add("jms://test2.queue?remoteSync=true");
                result.add("jms://test3.queue");
               
                return result;
        }
}




Thanks in advance for any assistance, this is a business critical issue for us.

Regards,

Richard

 « Return to Thread: JMS Reply To Issue