Setting up a JMS bridge between Weblogic and HornetQ

I’d like to publish my notes about how to setup a basic JMS bridge between a Weblogic Server and an instance of HornetQ, running on a JBoss 6.1 Application Server. My reference was the document “Configuring and Managing the WebLogic Messaging Bridge”.

First of all, I copied the following libraries to a folder residing in a filesystem of my Weblogic server:

  • hornetq-core-client.jar
  • hornetq-jms-client.jar
  • netty.jar
  • jnp-client.jar
  • jboss-logging.jar

Later on, I set the PRE_CLASSPATH variable pointing it to these libraries into the script setDomainEnv and started Weblogic, so I could use the console to create the source bridge destination, a typical Weblogic one, just selecting the default JNDI adapter name: eis.jms.WLSConnectionFactoryJNDIXA, and putting the JNDI name of my Connection Factory and my Queue in. Here you have an excerpt of the resulting config.xml file:

<jms-bridge-destination>
   <name>JMS Bridge Destination-Source</name>
   <adapter-jndi-name>eis.jms.WLSConnectionFactoryJNDIXA</adapter-jndi-name>
   <classpath></classpath>
   <connection-factory-jndi-name>jms/TestXAQueueConnectionFactory</connection-factory-jndi-name>
   <connection-url></connection-url>
   <destination-jndi-name>jms/TestQueue</destination-jndi-name>
</jms-bridge-destination>

After that, I created the target bridge destination, the HornetQ one (I’ve previously set up the needed objects on HornetQ, please review its user manual for further information). In addition to the JNDI names of the Connection Factory and the Queue, I had to configure the URL of the JNDI server used by the HornetQ instance, in my case jnp://srvhornetq.test.local:1099. After save the destination, I had to edit it, modify the default initial connection factory weblogic.jndi.WLInitialContextFactory to org.jnp.interfaces.NamingContextFactory, and restart the Weblogic server. The resulting piece of configuration on config.xml is:

<jms-bridge-destination>
   <name>JMS Bridge Destination-Target</name>
   <adapter-jndi-name>eis.jms.WLSConnectionFactoryJNDIXA</adapter-jndi-name>
   <classpath></classpath>
   <connection-factory-jndi-name>jms/TestXAQueueConnectionFactory</connection-factory-jndi-name>
   <initial-context-factory>org.jnp.interfaces.NamingContextFactory</initial-context-factory>
   <connection-url>jnp://srvhornetq.test.local:1099</connection-url>
   <destination-jndi-name>jms/TestQueue</destination-jndi-name>
   <destination-type>Queue</destination-type>
</jms-bridge-destination>

Finally, I setup the bridge as usual, just selecting the source and target destinations, the quality of service, etc:

<messaging-bridge>
   <name>Test-Bridge</name>
   <target>DefaultServer</target>
   <source-destination>JMS Bridge Destination- Source</source-destination>
   <target-destination>JMS Bridge Destination-Target</target-destination>
   <selector></selector>
   <quality-of-service>Exactly-once</quality-of-service>
   <started>true</started>
</messaging-bridge>

Please, be careful selecting the proper parameters for each situation, in order to avoid errors like JMS-107. For example, I recommend to create a javax.jms.XATopicConnectionFactory connection factory for a topic and a javax.jms.XAQueueConnectionFactory connection factory  for a queue, but I don’t use a generic javax.jms.XAConnectionFactory Of course, the’re a lot of issues about security, transactions, etc, but that’s the topic for another post!


References


Advertisements

3 Comments on “Setting up a JMS bridge between Weblogic and HornetQ”

  1. […] posted my notes about setting up a JMS bridge between Weblogic and HornetQ last September, now I’d like to talk about how to secure the connection: implementing an user […]

  2. […] talked in former posts about setting up a JMS bridge between Weblogic and HornetQ and how to secure that connection, but the bridge is just appropriate for sending messages from […]

  3. […] four years ago, I wrote about how to setup a JMS bridge between Weblogic and HornetQ. Lately, I’ve had to research how to do the same work with ActiveMQ. Here you have my […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s