[jboss-user] [JBoss Messaging] New message: "Re: Slow dequeue for singleton MDB"

Adrian Brock do-not-reply at jboss.com
Thu Jan 14 13:22:37 EST 2010


User development,

A new message was posted in the thread "Slow dequeue for singleton MDB":

http://community.jboss.org/message/520147#520147

Author  : Adrian Brock
Profile : http://community.jboss.org/people/adrian@jboss.org

Message:
--------------------------------------------------------------
This isn't really a JBoss Messaging question, if you're using Tibco EMS.
 
Anyway, the short answer is that we can't really answer your question, you'll have to ask Tibco.
 
The longer answer is that the delivery and prefetching of messages to an MDB is controlled by the ConnectionConsumer
which is implemented by Tibco (which is why only they can answer the question).
http://java.sun.com/j2ee/1.4/docs/api/javax/jms/ConnectionConsumer.html
 
The only thing we control is the ServerSessionPool which you've set to one Session if you
are using a Singleton MDB.
 
Their ConnectionConsumer will have some code that does something like the following:

while (notClosed)
{
   Message m = getNextMessageFromServer(); // A
   ServerSession s = jbossServerSessionPool.getServerSession(); // B
   addMessageToSession(s, m);
   s.start(); // C
}

 
Now at point (C) above we offload the work to a different thread so it ought to be able to get the next message from (A)
while it is processing the previous message.
But until that previous message completes, point (B) will block - that is the purpose of the singleton - no concurrent invocation.

Once the previous work has finished, point (B) will unblock and it should immediately process the next message.
Whether that is true, depends upon how Tibco implement the above method. e.g. if they have (A) and (B) the other way around, it
isn't going to get the next message until a session is available, which means you will see a latency.
 
NOTE: You can't just time your MDB's onMessage() method. There's work than that (assuming you are using JTA transactions).
We wrap your onMessage() method with something like:
 
Transasction tx = startTransaction();
tx.enlistResource(tibcoXAResource);
try
{
   yourMDB.onMessage(message);
}
finally
{
   tx.commit/rollback();
}

 
If you are doing work in a database in your MDB, the commit() at the end will have to do a 2 phase commit,
one branch for the DB and for one the Tibco message acknowledgement.

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/520147#520147




More information about the jboss-user mailing list