• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JMS and instance pool of msg driven beans

 
Vanessa Hall
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using JBoss 3.2.5 and trying to use JMS queues. I have set up a queue and a message-driven EJB.

My question has to do with the instance pool for the message-driven beans. When I send a message to the queue, JBoss creates 11 instances of my message-driven bean and onMessage is invoked on all of them.

I thought when using JMS queues, each message has only one consumer?

So my question is in 2 parts:

1. How do I configure the queue so that each message has one consumer? i.e. onMessage is invoked on only one bean.

2. Can I control the size of the instance pool for the message driven beans? I would like to limit the number of beans that can exist at any one time. If more messages come in than there are beans, I would like for it to wait until an existing bean is free instead of creating a new one. I noticed there is a MaxPoolSize attribute in the jmx console, but setting it for the message-driven bean does not seem to have any effect.

My XML:
In ejb-jar.xml:

<message-driven>
<description>Message Driven Bean</description>
<display-name>ScheduleServiceQueueHandler</display-name>
<ejb-name>ScheduleServiceQueueHandler</ejb-name>
<ejb-class>net.viewerapp.coreservices.jobs.impl.ScheduleServiceQueueHandlerBean</ejb-class>
<transaction-type>Container</transaction-type>
<acknowledge-mode>Auto-acknowledge</acknowledge-mode>
<message-driven-destination>
<destination-type>javax.jms.Queue</destination-type>
</message-driven-destination>
</message-driven>

In jboss.xml:

<message-driven>
<ejb-name>ScheduleServiceQueueHandler</ejb-name>
<destination-jndi-name>queue/schedServiceQueue</destination-jndi-name>
</message-driven>

In myqueue-service.xml:

<mbean code="org.jboss.mq.server.jmx.Queue"
name="jboss.mq.destination:service=Queue,name=schedServiceQueue">
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager</depends>
</mbean>

Thanks in advance for any help you can offer!
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I send a message to the queue, JBoss creates 11 instances of my message-driven bean and onMessage is invoked on all of them.




How is that possible ? A message in a queue can be consumed by only one client.
 
Thomas Mechlinski
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I had the same problem. The MDB instances are held in a pool. JBossMQ starts a number of them when the MDB reads in the queue. The number of instances can be customized in

$JBOSS_HOME/server/<server-name>/conf/standardjboss.xml

Search for

ServerSessionPoolFactoryJNDI

and adjust the MaximumSize property to the appropriate value (can be 1, than only one instance is active):

<MaximumSize>1</MaximumSize>

This solved my problem - hope it will work for you, too.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic