activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agrabil <greg.ra...@ins.com>
Subject Re: JMS to JMS Bridge
Date Tue, 01 Aug 2006 16:31:08 GMT

Hello,
I believe that I have identified the issue with this particular problem.  It
appears that the code in the JmsQueueConnector class assumes that the name
of the outboundQueueName is also the name of the local (ActiveMQ) queue.  In
this situation, this is not the case.  In fact, as SwiftMQ requires a naming
convention of "queueName@router", which is not a valid queue name for
ActiveMQ.  I believe that this same problem could occur with the
InboundQueueBridge as well.  I have implemented a fix, which I would like to
confirm is appropriate.  First, I added a 'localQueueName' property to both
the InboundQueueBridge and OutboundQueueBridge classes, along with the
customary getter/setter.  Then, in the JmsQueueConnection class, I modified
the initializeInboundQueueBridges and initializeOutboundQueueBridges to
obtain the localQueueName from the Inbound/OutboundQueueBridge and set that
for the ActiveMQ queue name:


    protected void initializeInboundQueueBridges() throws JMSException{
        if(inboundQueueBridges!=null){
            QueueSession outboundSession =
outboundQueueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
            QueueSession localSession =
localQueueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
            for(int i=0;i<inboundQueueBridges.length;i++){
                InboundQueueBridge bridge=inboundQueueBridges[i];
                String localQueueName = bridge.getLocalQueueName();
                Queue
activemqQueue=createActiveMQQueue(localSession,localQueueName);
                String queueName=bridge.getInboundQueueName();
                Queue
foreignQueue=createForeignQueue(outboundSession,queueName);
                bridge.setConsumerQueue(foreignQueue);
                bridge.setProducerQueue(activemqQueue);
                bridge.setProducerConnection(localQueueConnection);
                bridge.setConsumerConnection(outboundQueueConnection);
                if(bridge.getJmsMessageConvertor()==null){
                   
bridge.setJmsMessageConvertor(getInboundMessageConvertor());
                }
                bridge.setJmsConnector(this);
                addInboundBridge(bridge);
            }
            outboundSession.close();
            localSession.close();
        }
    }

    protected void initializeOutboundQueueBridges() throws JMSException{
        if(outboundQueueBridges!=null){
            QueueSession outboundSession =
outboundQueueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
            QueueSession localSession =
localQueueConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
            for(int i=0;i<outboundQueueBridges.length;i++){
                OutboundQueueBridge bridge=outboundQueueBridges[i];
                String localQueueName=bridge.getLocalQueueName();
                Queue
activemqQueue=createActiveMQQueue(localSession,localQueueName);
                String queueName=bridge.getOutboundQueueName();
                Queue
foreignQueue=createForeignQueue(outboundSession,queueName);
                bridge.setConsumerQueue(activemqQueue);
                bridge.setProducerQueue(foreignQueue);
                bridge.setProducerConnection(outboundQueueConnection);
                bridge.setConsumerConnection(localQueueConnection);
                if(bridge.getJmsMessageConvertor()==null){
                   
bridge.setJmsMessageConvertor(getOutboundMessageConvertor());
                }
                bridge.setJmsConnector(this);
                addOutboundBridge(bridge);
            }
            outboundSession.close();
            localSession.close();
        }
    }

I have not committed changes to any open source projects before, so I am not
familiar with the process.  If these changes appear to be acceptable, please
let me know how to proceed.  Perhaps someone with developer credentials for
the project can simply incorporate these changes in a future build?

Thanks,
Greg Rabil
-- 
View this message in context: http://www.nabble.com/JMS-to-JMS-Bridge-tf1901141.html#a5598132
Sent from the ActiveMQ - User forum at Nabble.com.


Mime
View raw message