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.
INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory
PROVIDER_URL=file:/C:/IBM/JNDI
This uses a file based JNDI providor rooted at C:IBMJNDI.PROVIDER_URL=file:/C:/IBM/JNDI
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.
- 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.
- 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'
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
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!