• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

JMS and instance pool of msg driven beans

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Ranch Hand
Posts: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic