0
votes

We use JMS Queues in our application and the application is deployed on two nodes on a websphere cluster. The JMS queue is created on cluster level in websphere. We are using JMS message listener that gets invoked whenever there is a message in the queue.

I want to know how many message listener instances exists in such cases when there are two nodes. Currently We are observing the messages are processed simultaneously ie if two message are in queue they are picked right away instead of one after other. How to stop this issue. I want a sequential approach to process messages.Thanks

2

2 Answers

0
votes

I don't think that Message Driven Beans are the right solution for you in this case. Normally you use MDBs in a clustered environment because you would like that all MDBs run at the same time and consume messages in parallel to improve throughput.

You can stop the MDB on single cluster members using Listener Ports or Acitvation Specs. But then you don't have an automatical fail-over: https://www-01.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.base.doc/ae/umb_prolp.html

So maybe you would prefer to use an EJB-Timer and switch from a queue to a database table. You have to poll in this case an the table, but if you are using e.g. a Websphere Cluster it can take care for you that just one and only one instance of the EJB-Timer is running at a time: http://www-01.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.nd.doc/ae/tejb_timerserviceejb_enh.html?cp=SSAW57_8.5.5%2F1-3-0-12-1-2

0
votes

There is exact solution for your needs out of the box. You can google it by "Strict message ordering for bus destinations" in case if the following link will corrupt.

All you need is to set "Service Integration - Buses > BUSName > Destinations > QueueName"; Option "Maintain strict message order" checkbox.

http://www.ibm.com/support/knowledgecenter/SSAW57_8.0.0/com.ibm.websphere.nd.doc/info/ae/ae/cjo_message_order_.html