You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by darickard <da...@yahoo.com> on 2008/08/22 20:02:23 UTC

jms to jms bridge (to JBoss MQ)

I've been trying to create a config file (activemq.xml) for the following
setup, but I just can't seem to get it to work. I can get messages on the
queue, but they're not getting bridged to JBoss MQ. I've read and re-read
the help on http://activemq.apache.org/jms-to-jms-bridge.html, I looked over
the test cases that come with the source distro, and I've searched and read
a lot of postings on the forum, but just can't seem to get it right. Can
someone please give me a hand?

Setup:

- ActiveMQ 5.1
- Standalone Java 1.6 app.
- Want to have an embedded ActiveMQ broker so that I can put things on its
queue using the vm://brokerName syntax. The messages should be persisted
locally - the default kaha method is fine, no rdbms needed. I was able to
config this broker okay and I have code that can successfully put messages
on its queue.
- Want all messages that are enqueued to the embedded broker's queue to be
forwarded to an instance of JBoss MQ (JBoss 4.0.3) running on a different
server. This is the part I was not able to get working.
- Want ActiveMQ to handle the loss of connectivity to JBoss MQ gracefully.
If JBoss goes down or the connection is temporarily lost (it's over a WAN
connection), ActiveMQ should handle that for my app so I can continue to use
the ActiveMQ queue with no impact and my messages will eventually make it to
the JBoss queue when it's again available.

Any help or assistance would be greatly appreciated!

Thanks,
Dave 

My current (not working) activemq.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
    <!-- 
    This is the main broker. Put messages here to get them relayed. The uri
to
    access this broker from within the JVM is vm://mainBroker.
    -->
    <bean id="mainBroker" class="org.apache.activemq.broker.BrokerService"
init-method="start" destroy-method="stop">
        <property name="brokerName" value="mainBroker"/>
        <property name="persistent" value="false"/>
        <property name="transportConnectorURIs">
            <list>
                <value>vm://localhost</value>
            </list>
        </property>

        <property name="jmsBridgeConnectors">
            <list>
              <ref bean="jmsQueueConnector"/>
           </list>
        </property>
    </bean>
    
    <!-- the jms queue connector "A Bridge to other JMS Queue providers" -->
   <bean id="jmsQueueConnector"
class="org.apache.activemq.network.jms.JmsQueueConnector">
      <property name="name" value="jmsQueueBridge"/>
      <property name="jndiOutboundTemplate" ref="remoteJndi"/>
      <property name="outboundQueueConnectionFactoryName"
value="UIL2ConnectionFactory"/>
      <property name="outboundQueueBridges">
         <list>
            <ref bean="outboundQueueJbossBridge" />
         </list>
      </property>  
  </bean>

    <!-- jndi template -->
  <bean id="remoteJndi" class="org.springframework.jndi.JndiTemplate">
    <property name="environment">
      <props>
        <prop key="java.naming.provider.url">jnp://10.3.0.181:1099</prop>
        <prop
key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>
      </props>
    </property>
  </bean>

    <!-- outbound queue -->
   <bean id="outboundQueueJbossBridge"
class="org.apache.activemq.network.jms.OutboundQueueBridge">
      <property name="outboundQueueName" value="queue/JobRequestQueue"/>
   </bean>

</beans>


-- 
View this message in context: http://www.nabble.com/jms-to-jms-bridge-%28to-JBoss-MQ%29-tp19112646p19112646.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: jms to jms bridge (to JBoss MQ)

Posted by darickard <da...@yahoo.com>.
Thanks for the response. I will check out Camel to see if that makes sense
for my use case. (If that's the "best practice", I think the JMS-to-JMS
Bridge page on the ActiveMQ site should be updated to recommend that.) 

In the meantime, I've already invested a lot of time into the ActiveMQ
solution and I feel like I'm very close. Do you see a quick change that I
could make to activemq.xml to get it working?

Thanks again,
Dave


James.Strachan wrote:
> 
> I'd be tempted to use Camel instead...
> 
> <route>
> <from uri="activemq:MyQueue"/>
> <to uri="jms:SomeOtherQueue"/>
> </route>
> 
> http://activemq.apache.org/camel/enterprise-integration-patterns.html
> 
> then under the covers its using Spring and their JMS helper classes etc
> http://activemq.apache.org/camel/jms.html
> 
> <original message snipped>
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://open.iona.com
> 
> 

-- 
View this message in context: http://www.nabble.com/jms-to-jms-bridge-%28to-JBoss-MQ%29-tp19112646p19113230.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: jms to jms bridge (to JBoss MQ)

Posted by James Strachan <ja...@gmail.com>.
I'd be tempted to use Camel instead...

<route>
<from uri="activemq:MyQueue"/>
<to uri="jms:SomeOtherQueue"/>
</route>

http://activemq.apache.org/camel/enterprise-integration-patterns.html

then under the covers its using Spring and their JMS helper classes etc
http://activemq.apache.org/camel/jms.html


2008/8/22 darickard <da...@yahoo.com>:
>
> I've been trying to create a config file (activemq.xml) for the following
> setup, but I just can't seem to get it to work. I can get messages on the
> queue, but they're not getting bridged to JBoss MQ. I've read and re-read
> the help on http://activemq.apache.org/jms-to-jms-bridge.html, I looked over
> the test cases that come with the source distro, and I've searched and read
> a lot of postings on the forum, but just can't seem to get it right. Can
> someone please give me a hand?
>
> Setup:
>
> - ActiveMQ 5.1
> - Standalone Java 1.6 app.
> - Want to have an embedded ActiveMQ broker so that I can put things on its
> queue using the vm://brokerName syntax. The messages should be persisted
> locally - the default kaha method is fine, no rdbms needed. I was able to
> config this broker okay and I have code that can successfully put messages
> on its queue.
> - Want all messages that are enqueued to the embedded broker's queue to be
> forwarded to an instance of JBoss MQ (JBoss 4.0.3) running on a different
> server. This is the part I was not able to get working.
> - Want ActiveMQ to handle the loss of connectivity to JBoss MQ gracefully.
> If JBoss goes down or the connection is temporarily lost (it's over a WAN
> connection), ActiveMQ should handle that for my app so I can continue to use
> the ActiveMQ queue with no impact and my messages will eventually make it to
> the JBoss queue when it's again available.
>
> Any help or assistance would be greatly appreciated!
>
> Thanks,
> Dave
>
> My current (not working) activemq.xml file:
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
> "http://www.springframework.org/dtd/spring-beans.dtd">
>
> <beans>
>    <!--
>    This is the main broker. Put messages here to get them relayed. The uri
> to
>    access this broker from within the JVM is vm://mainBroker.
>    -->
>    <bean id="mainBroker" class="org.apache.activemq.broker.BrokerService"
> init-method="start" destroy-method="stop">
>        <property name="brokerName" value="mainBroker"/>
>        <property name="persistent" value="false"/>
>        <property name="transportConnectorURIs">
>            <list>
>                <value>vm://localhost</value>
>            </list>
>        </property>
>
>        <property name="jmsBridgeConnectors">
>            <list>
>              <ref bean="jmsQueueConnector"/>
>           </list>
>        </property>
>    </bean>
>
>    <!-- the jms queue connector "A Bridge to other JMS Queue providers" -->
>   <bean id="jmsQueueConnector"
> class="org.apache.activemq.network.jms.JmsQueueConnector">
>      <property name="name" value="jmsQueueBridge"/>
>      <property name="jndiOutboundTemplate" ref="remoteJndi"/>
>      <property name="outboundQueueConnectionFactoryName"
> value="UIL2ConnectionFactory"/>
>      <property name="outboundQueueBridges">
>         <list>
>            <ref bean="outboundQueueJbossBridge" />
>         </list>
>      </property>
>  </bean>
>
>    <!-- jndi template -->
>  <bean id="remoteJndi" class="org.springframework.jndi.JndiTemplate">
>    <property name="environment">
>      <props>
>        <prop key="java.naming.provider.url">jnp://10.3.0.181:1099</prop>
>        <prop
> key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>
>      </props>
>    </property>
>  </bean>
>
>    <!-- outbound queue -->
>   <bean id="outboundQueueJbossBridge"
> class="org.apache.activemq.network.jms.OutboundQueueBridge">
>      <property name="outboundQueueName" value="queue/JobRequestQueue"/>
>   </bean>
>
> </beans>
>
>
> --
> View this message in context: http://www.nabble.com/jms-to-jms-bridge-%28to-JBoss-MQ%29-tp19112646p19112646.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>



-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com