• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

MDB Pool subscribed to a Topic

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In MDB deployment descriptor we define <max-beans-in-free-pool> and <initial-beans-in-free-pool> elements.
During their deployment the number of beans given in <initial-beans-in-free-pool> tag are created.
For example:
----------------------------------------
<message-driven-descriptor>
<pool>
<max-beans-in-free-pool>200</max-beans-in-free-pool>
<initial-beans-in-free-pool>20</initial-beans-in-free-pool>
</pool>
<destination-jndi-name>quotes</destination-jndi-name>
</message-driven-descriptor>
Here in example <destination-jndi-name> is jndi name for Topic destination.
----------------------------------------
Once the server is started the 20 bean instances are created. And they are ready to receive messages.
because all 20 instances of the bean have subscribed to the single Topic, all the instances should receive the message. But, this is not happening!, only one instance in the pool is receiving message.
I have tried this on Weblogic 6.1 server, and have no idea whether other Application servers allow to create such pools.
Any way, my question is,
1) All the 20 instances have same implementation of OnMessage method, then why we should create the pool? Is the any other advantages, that i am not able to think of?
2) How the server is managing to pass the message to only one instance in the pool, in-spite of the fact that the bean implements MessageListener interface?
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The pool is used for serving multiple concurrent messages. For example, if your topic receives two messages, the EJB Container picks two instances from the pool of that particular MDB to process the two messages.
If you want 20 MDBs to process every message for a topic, you need to deploy your MDB 20 times (with different JNDI names of course) each having its own instance pool -- possibly of varying sizes.
 
Sameer Boddun
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are right!!, Thanks for helping...
 
I will suppress my every urge. But not this shameless plug:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic