File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Websphere and the fly likes JMS Q in clustered environment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "JMS Q in clustered environment" Watch "JMS Q in clustered environment" New topic

JMS Q in clustered environment

Jignesh Patel
Ranch Hand

Joined: Nov 03, 2001
Posts: 626

How to integrate JMS Q in cluster aware environment? I am using WAS 7 servers in cluster mode.
I am using Spring Framework.

I am envisioning as follows
1. I do have 2 WAS servers with each having JMS engine configured.
2. There will be a distributed queue connected to both of the JMS engines.

Has above understanding is correct?
Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 446
Configuring JMS in WebSphere 6.1.x or 7.x is very similar. It is a long list of never ending tasks. But you can always script it in Jython and then you dont have to bother about it.

I am using JMS in clustered mode in WebSphere 7 and I configured it as follows. Initially I did manual configuration and later on scripted the whole thing in Jython. You may already be knowing most of this but I thought I will compile it for the completeness.

1. Create Service Integration Bus (SIB)
2. Add App Cluster as the Bus Member, which will also create first messaging engine
3. Add second messaging engine as you have two app servers in app cluster
4. You specify the file store for both the messaging engines.
5. Create JMS Connection Factory and associate it with the SIB.
6. Create SIB Destination (SIB Topic or SIB Queue)
7. Create JMS Destination, which is either Queue or TopicSpace
8. Create JMS Activation Specification that connects the SIB Destination to JMS Destination
9. Setup CoreGroup policy so that messaging engines are dedicated to application servers of the cluster. So each app server in the cluster will handle one messaging engine.
10. Now write Message Driven Beans (MDB) and implement the desired functionality
11. Create ibm-ejb-jar-bnd.xml file with one entry for every MDB.
<message-driven name="TransactionListenerMDB">
<jca-adapter activation-spec-binding-name="<<Topic or Queue ACTI SPEC JNDI GOES HERE>>"
destination-binding-name="<<JMS Topic or Queue JNDI GOES HERE>>" />
12. Specify the EJB3 annotations on top of the MDB file as follows:
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "<<JMS Topic or Queue JNDI GOES HERE>>") }, messageListenerInterface = javax.jms.MessageListener.class)
@TransactionAttribute(<<Transaction Attribute GOES HERE>>)
Jignesh Patel
Ranch Hand

Joined: Nov 03, 2001
Posts: 626

Thanks Deepak,

Did you ever have an experience of creating Topic On the Fly. I have a requirement where I need to create a subscriber until message comes back through JMS queue and then publisher publish it to topic and then subscriber takes appropriate action.
Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 446
No I have never done such implementation.
I agree. Here's the link:
subject: JMS Q in clustered environment
It's not a secret anymore!