|
Problem(Abstract) |
How can the message order be guaranteed to a Message
Driven Bean (MDB)? |
|
|
|
Resolving the
problem |
To ensure that a given MDBListener processes messages in
order, the ListenerPort maxSessions property must be set to 1. This means
that only one MDB ServerSession and thus only one MDB instance will
process messages on that Server. MDBListeners are per Server, and thus if
a given MDB is deployed across a given cell, then an MDBListener
will be created on each Server, all consuming from the same destination.
Logically, to guarantee the message order there must be a single consumer
thread. If there is more than one ServerSession or more than one
MDBListener, these independent threads can not be controlled. So defining
one MDBListener on a single Server with ListenerPort settings of
maxSessions = 1 and maxMessages = 1 will ensure that the message
processing order is correct.
Note: The maxMessages should always be set to 1 for WebSphere MQ JMS
because of the transactional behavior of WebSphere MQ. The maxMessages
property controls the batching of messages passed to the MDB
ServerSession. |
|
|
|
|
Cross Reference information |
Segment |
Product |
Component |
Platform |
Version |
Edition |
Application Servers |
Runtimes for Java Technology |
Java SDK |
|
|
|
|
|
|