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

Deploying MDBs in a Websphere Cluster

Aoife Kavanagh

Joined: Feb 28, 2005
Posts: 16

I'm trying to determine how it is ensured that JMS messages are processed in the correct order when the MDB(s) handling them are deployed in a Websphere cluster. Suppose, I have an EAR file containing an MDB. I deploy the EAR file to a cluster which contains 3 servers (server1, server2, server3). This means that each of those servers has a message listener port which the deployed bean is assigned. When the cluster is started doesn't this then mean that there are 3 message listener ports (as 3 servers in the cluster) listening on the one queue? My client requires that the JMS messages are processed in the order in which they are placed on the queue. How do I ensure that this occurs? That is, I don't want server1 processing messageA simultaneously with server2 processing messageB which I can see happening due to the multiple message listener ports.

I've had a search to try and find an answer to this so I apologise if I've missed the obvious.

Jim Janssens
Ranch Hand

Joined: Sep 24, 2004
Posts: 210
For starters, I doubt that JMS queues ensure order. It could be that order is maintained, but you should not count on it. This means that when client 1 sends message A and afterwards it sends message B that the MDB could first be invoked with message B. I'm not 100% sure of this, but there is a short explanation about this in the EJB spec you can look it up there.


In case you are using one JMS server for all of the three servers:

A queue only supports the receiving of the message ONCE. So, one of the 3 servers will process the message. You will not know which will, but you are sure that a message will be only consumed by ONE server only. So nothing to worry about there.

In case you you using the WAS embedded JMS server (meaning that each server has its own JMS):

You will explictly have to send the message to one of the three servers. Thus a message is send to one JMS server and processed by that server.
Aoife Kavanagh

Joined: Feb 28, 2005
Posts: 16
Hi Koen,

Thanks for the reply but it doesn't provide me with the information that I require. My JMS provider is Websphere MQ which to the best of my knowledge offers a FIFO ordering. Suppose that the messages on the queue are Msg1, Msg2, Msg3 and they were placed on the queue in that order. In an unclustered environment I know that there is just server and so just one message listener port listening on the qeuue. Consequently, I am guaranteed that the listener port will process the messages in the order that it finds them in the queue.
In a clustered environment there may be multiple servers and hence multiple message listener ports. While I know the messages will come off the queue FIFO, Msg1 may be dealt with by listener port on server 1(and hence bean on server1), Msg2 may be be dealt with by listener port on server 2(and hence bean on server2) etc. Hence, no guarantee that messages aren't in fact processed simultaneously.
I'm sure that other Websphere MQ/WAS users must have come across this, and I'd like to think that IBM do handle this scenario, but I'm unsure how, and if there is any additional configuration that I need to do.

I agree. Here's the link:
subject: Deploying MDBs in a Websphere Cluster
jQuery in Action, 3rd edition