Is it possible to create a single-threaded MDB so there is no-concurrency. The messages will be processed in the order they are put on the queue. I know JMS client can do it. What about MDB?
Kyle Brown
author
Ranch Hand
Joined: Aug 10, 2001
Posts: 3879
posted
0
If you set the number of MDB's in the pool to 1, then you have, in effect, made the MDB single-threaded. Kyle
Originally posted by Kyle Brown: If you set the number of MDB's in the pool to 1, then you have, in effect, made the MDB single-threaded. Kyle
I do not think it ensures the single thread. The number of bean instances outside the pool can well be greater than one. Those instances run concurrently. I heard that JBoss supports single-threaded MDB.
Kyle Brown
author
Ranch Hand
Joined: Aug 10, 2001
Posts: 3879
posted
0
Jim, I don't understand how this could be true. The MDB's in the method-ready pool are the only things that can accept onMessage() methods. If the number of EJBs in this pool is exactly one (both minimum and maximum) then while that instance is busy no other processing can take place. I don't understand what you mean by "instances outside the pool". AFAIK, there should be no instances outside the pool. Even if they were, why would they be running concurrently? Kyle
Jim Baker
Ranch Hand
Joined: Mar 10, 2002
Posts: 177
posted
0
Kyle, I checked the J2EE spec. You are right. There are no running instances that are not in the pool. Thanks.
Kyle Brown
author
Ranch Hand
Joined: Aug 10, 2001
Posts: 3879
posted
0
No problem, Jim. I just hope this helped the fellow who asked the original question. Kyle
S. Palanigounder
Ranch Hand
Joined: Apr 03, 2003
Posts: 145
posted
0
There is no way to ensure FIFO in a cluster. Right?
Kyle Brown
author
Ranch Hand
Joined: Aug 10, 2001
Posts: 3879
posted
0
That is true. However that is generally true of messaging systems where there are more than one client processing messages off a shared queue. In that case, you need something like a Resequencer. By the way, I have to make a shameless plug here. If you're REALLY interested in design for messaging systems and solving problems like this, take a look at Enterprise Integration Patterns by Bobby Woolf and Gregor Hohpe, (with Martin Fowler and me contributing) which covers this and a host of other tough problems in messaging design. Kyle [ November 26, 2003: Message edited by: Kyle Brown ]