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!