Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MDB Pool subscribed to a Topic

 
Sameer Boddun
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • 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?
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right!!, Thanks for helping...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic