• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Single-Threaded MDB?

 
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you set the number of MDB's in the pool to 1, then you have, in effect, made the MDB single-threaded.
Kyle
 
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kyle, I checked the J2EE spec. You are right. There are no running instances
that are not in the pool. Thanks.
 
Kyle Brown
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem, Jim. I just hope this helped the fellow who asked the original question.
Kyle
 
S. Palanigounder
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no way to ensure FIFO in a cluster. Right?
 
Kyle Brown
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kyle, Thanks for the info.
    Bookmark Topic Watch Topic
  • New Topic