activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kubofary <>
Subject JMS Bridge to third party broker providing only ConnectionFactory
Date Tue, 16 Sep 2014 11:37:48 GMT
I need to establish a JMS to JMS bridge between ActiveMQ and a third party
JMS broker (webMethods broker). The remote system provides a
ConnectionFactory and several Destinations (instances of javax.jms.Queue)
through JNDI.
I tried to follow the example at , but I haven't found a
way to instantiate the inbound and outbound queue bridges using the generic
javax.jms.ConnectionFactory. Even looking at the code in and, it seams that I need an
instance of javax.jms.QueueConnectionFactory.

For example,I can read from the remote queue using a simple java client like
this (without needing to know that it is a Queue at all):

ConnectionFactory myConnFactory = (ConnectionFactory)
Destination queue = (Destination) namingContext.lookup(REMOTE_QUEUE_NAME);
Connection conn = myConnFactory.createConnection();
Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageConsumer consumer = session.createConsumer(queue);
Message message = consumer.receive();

I need to map this remote Destination to a local ActiveMQ Queue, so that my
application is decoupled from the remote JMS broker and ActiveMQ acts as a
Normally, I would do something like:
            inboundQueueName = "REMOTE_QUEUE_NAME" 
            localQueueName   = "LOCAL_QUEUE_NAME" />

    <bean id="remoteJndi" class="org.springframework.jndi.JndiTemplate">
        <property name="environment">

    <bean id="jndiLookupFactory"
        <constructor-arg ref="remoteJndi" />

But this apparently doesn't work, because I only get a ConnectionFactory
instance, while JmsQueueConnector is expecting a QueueConnectionFactory.

I was thinking about using a DelegatingConnectionFactory from Spring, but
that still wouldn't work, because the returned Connections still wouldn't be
QueueConnection implementations.

Is there a way to do this simply by configuring activemq.xml differently, or
do I need to implement my own implementations of QueueConnectionFactory,
QueueConnection, and QueueSession that would delegate the calls to queue
specific methods to the generic methods in ConnectionFactory, Connection,
and Session?

Thank you

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message