wood burning stoves 2.0*
The moose likes Websphere and the fly likes Single-Threaded MDB? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "Single-Threaded MDB?" Watch "Single-Threaded MDB?" New topic
Author

Single-Threaded MDB?

S. Palanigounder
Ranch Hand

Joined: Apr 03, 2003
Posts: 145
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: 3892
    
    5
If you set the number of MDB's in the pool to 1, then you have, in effect, made the MDB single-threaded.
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Jim Baker
Ranch Hand

Joined: Mar 10, 2002
Posts: 177
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: 3892
    
    5
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
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: 3892
    
    5
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
There is no way to ensure FIFO in a cluster. Right?
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
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 ]
S. Palanigounder
Ranch Hand

Joined: Apr 03, 2003
Posts: 145
Kyle, Thanks for the info.
 
 
subject: Single-Threaded MDB?