Win a copy of liveProject: Protecting User Data with Spring Security and OAuth2 this week in the Spring forum!
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Concurrency in Message Driven Beans

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Davide for your clarification. I am now more confortable wiht the MDB life cycle
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic