Pages

Thursday, May 15, 2014

ActiveMQ & IIB with JMS

In this topic I will give you some hints on how to connect your IBM Integration Bus to a JMS provider ActiveMQ.
The following link is very useful:
http://www.ibm.com/developerworks/websphere/library/techarticles/1211_eswarachary/1211_eswarachary.html
There are however few information concerning the configuration.
I provided here after some extra informatio.

Configuration

Runtime configuration

In the MQ Explorer, select the "JMSProviders/ActiveMQ" configurable service  of the Integration node you want to use.




 The default_Path refers to the shared class directory of the IBM Integration Node.

 The jars of ActiveMQ have to be placed into a directory.
I usually place them in a dedicated directory under the homePath of the IIB Node which on windows is "C:\ProgramData\IBM\MQSI".
You can know the path using following command and look for "Local Work Path":
mqsiservice INodeName



Jar file

In order to be able to access activeMQ, the integration node needs the JMS provider jar file and place them in a location accessible to the node. I found convenient to copy the activemq-all.jar file only.

JNDI Bindings
In order to retrieve the connection factory, the Integration node needs to have a JNDI.
A default JNDI is provided with ActiveMQ: org.apache.activemq.jndi.ActiveMQInitialContextFactory

The jndi objects configuration can be found at the following link:
http://activemq.apache.org/jndi-support.html

You need to make this configuration file, the jndi.properties file, accessible to the IntegrationNode.
As explain at the link:
"
Once you have the jndi.properties edited and ready, it needs to be accessible to your application. The easiest way is to add jndi.properties to a jar file. When "new InitialContext()" is called, it will scan the resources and find the file.
 "
So place the file in a jar file - I just created a zip file, placed the property file in it and renamed the extension to "jar" - and place the jar file in the directory where you put the activemq jars.

In my configuration I have:




And in this directory I have the activemq.jar as well as another jar that contains my file "jndi.properties".

The content of my jndi.properties is:

java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
java.naming.provider.url=vm://localhost
connectionFactoryNames=connectionFactory, queueConnectionFactory, topicConnectionFactory
queue.jmsINQ=IN.Q
queue.jmsOUTQ=OUT.Q

There is a default connection factory "connectionfactory" and two queues.
The jndi name for the queue IN.Q defined on ActiveMQ is "queue.jmsINQ". The queue is accessed from the node using the alias name "jmsINQ" (without queue).

IIB Node configuration

Node configuration

The JMS Provider name on the JMSInput node is using a configurable service.
If the corresponding runtime configurable service property is not changed (let the defaulr), the property on the node will be used.
If you change the default property value on the conf. service then this property will be used.


Here is the configuration of my input node:

 

The connection factory "connectionfactory" is the one by default and defined in the jndi.properties.
And in the "basic" tab of the node, I put the alias name defined in the jndi properties file: jmsINQ for the input.



That's it !!

Testing

If you go on active MQ -> admin -> connections
you will see your connection.
Message can be send from ActiveMQ using the "send" tab.


3 comments:

  1. I am new to this tool, so kindly guide us by providing information for the following queries.

    1)You are using which version of the tool and software

    2)which software tool to get that folder structure.

    please clarify my doubt ASAP.

    Regards,
    Vamsi Alla

    ReplyDelete
  2. The Software was IBM Integration Bus V9.
    Don't understand what you mean for the folder structure. It is on windows system under the C:\ProgramData\IBM\MQSI

    ReplyDelete
  3. Visist www.vaithu.coom to know IIB offerings

    ReplyDelete