Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Concurrency in Message Driven Beans

 
Yeray Santana Borges
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a doubt about how the container process messages simultaneously. Have may differents threads running the same Message Driven Bean Instance ?

For example, if my continer only have a pool of one Message Driven Bean instances, and I have three different clients that send three messages to the same destination, the messages are processed concurrently in the only one intance or the container get the first message, process it, after get the the second process it ... only one thread running per instance.

Thanks.
 
Davide Crudo
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is just a guess...as I'm not an expert, but
reading the Message Bean life Cycle, i would guess the following:

The EJB container starts MDBs instances and put them in a Pool. If in the pool there are multiple MDBs they can run
at the same time since as I understood it, each instance has its own thread.

If, as you specified, the pool only contains one Bean, I would expect the container to automatically initialize a new
bean and increase the pool.

If on the other hand, as in your case, all beans in the pool are busy (or only one bean is in the pool and the pool size is fixed),
i would expect that a new message is only processed when the MDB is finished with the previous one...

Dave
 
Yeray Santana Borges
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Davide for your clarification. I am now more confortable wiht the MDB life cycle
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic