Feeding Time

Feeding Time

How to Feed Oracle BAM from IBM MQ Series

I'm working with a customer who has IBM MQ installed and wants to intercept messages from MQ and deliver them to Oracle BAM.  Thought you might be interested in how I set things up in my environment to try this out.

Setting Up MQ Series

To begin with I installed MQ Series, I installed Server as I was running on a single machine but it should work fine with client as well.  I also installed the 6.0.2 update for MQ and the Pub/Sub plugin for Eclipse.  After a default installation of MQ Series I needed to set up publish subscribe.  This was achieved as follows:
  • I used the MQ Explorer to start the Message Broker.  By default it is not started.  To start it I went to 'Queue Managers/QMgr_Name/Advanced/Services', selected 'Show System Objects' and started the 'System.Broker'.
  • I created the JMS queues needed by the JMS pub/sub interface by running the command 'runmqsc QM_w2k3 < MQJMS_PSQ.mqsc' in the $MQ_HOME/java/bin directory.
I then needed to create a JNDI tree with links to appropriate MQ objects.  I started by creating a directory for my JNDI entries (I used C:IBMJNDI) and then I configured the JMS Admin tool by editing $MQ_HOME/Java/bin/jmsadmin.config to have the following entries:
This uses a file based JNDI providor rooted at C:IBMJNDI.
It is sometimes handy to use the JMS Admin tool but the new JMS support in Eclipse makes it easier to create entries in JMS using that tool rather than JMS Admin.
  • To set up MQ Explorer for JMS navigate to 'JMS Administered Objects' and select 'Add Initial Context ...'.  Then I selected the File Based provider and chose the directory I wanted to use.
I then used the Eclipse JMS Admin tool to create bindings for the Topic Connection Factory and the Topic I was going to use from BAM.
  • Create the TopicConnectionFactory entry by navigating to 'JMS Administered Objects/location/Connection Factories' and right clicking to get 'New->Connection Factory ...'
  • Give the factory a name and make it a TopicConnectionFactory.
Now I had MQ installed and the broker running with a TopicConnectionFactory registered in the JNDI naming tree I had to set up a Topic.
  • I navigated in MQ Explorer to 'JMS Administered Objects/location/Destinations' and right clicked to choose 'New->Destination ...'.
  • I gave the topic a name - myTopic.
  • Selected the type of destination to be a Topic.
  • On the General property screen I gave a name for the topic within MQ series - this can be the same or different to the topic name given previously  Note that MQ Topic names are recommended to use '/' as a separator for readability.  If this is desired for the JNDI name then sub contexts should be created to give the same effect.
  • On the Broker property screen I selected my Queue Manager and then I selected my stream to be the 'SYSTEM.BROKER.DEFAULT.STREAM'
The new support in Eclipse for Pub/Sub makes it so much easier than the old way of creating manually hooking up streams and queues to the broker.  Well done to the MQ Eclipse plug in team at IBM.

Registering MQ Series with BAM

With MQ configured the way I needed it the next step was to register the MQ libraries with BAM as a resource providor.  First within BAM Administrator I modified the Websphere MQ Enterprise Message Source Type to point to my MQ installation, at the same time removing the non-Websphere references from the startup parameters.  This left me with the following in startup parameters:
JMS*".;C:\IBM\WebSphere MQ\Java\lib\com.ibm.mq.jar;C:\IBM\WebSphere MQ\Java\lib\com.ibm.mqjms.jar;C:\IBM\WebSphere MQ\Java\lib\connector.jar;C:\IBM\WebSphere MQ\Java\lib\jms.jar;C:\IBM\WebSphere MQ\Java\lib\jndi.jar;C:\IBM\WebSphere MQ\Java\lib\jta.jar;C:\IBM\WebSphere MQ\Java\lib\providerutil.jar;C:\IBM\WebSphere MQ\Java\lib\fscontext.jar;C:\IBM\WebSphere MQ\Java\lib\ldap.jar;"
I then went into BAM Architect to define my message source.  I created a new Websphere MQ message source and provided the following settings:
  • Initial Context Factory: com.sun.jndi.fscontext.RefFSContextFactory
  • JNDI Service Provider URL: file:/C:/IBM/JNDI
  • TopicConnectionFactory Name: mqTCF
  • Topic Name: myTopic
  • JMS Message Type: Text Message
I set a string message size of 2000 bytes as I know they are small messages.

Processing JMS Messages in BAM

Everything is now ready to start receiving messages in BAM.  For details of how to process JMS messages in BAM look this tutorial.

Important Note

Enterprise Link only appears to support Topics for subscription, not queues, so if you need to process queues then you will need to take messages off the queue and post them onto a topic.  One mechanism for doing this is the JMS Router in the oracle application server.

Hopefully this will fill a hole in how to get data from MQ series into BAM.  Have fun!


Post a Comment:
Comments are closed for this entry.

Musings on Fusion Middleware and SOA Picture of Antony Antony works with customers across the US and Canada in implementing SOA and other Fusion Middleware solutions. Antony is the co-author of the SOA Suite 11g Developers Cookbook, the SOA Suite 11g Developers Guide and the SOA Suite Developers Guide.


« June 2016