9 Replies Latest reply on May 27, 2006 2:50 PM by Serge Redchuk

    Can't use EJB3 MDB to retrieve messages one by one.

    Serge Redchuk Newbie

      I'll be as short as possible. Thank you.
      Jboss version: 4.0.4RC1
      EJB3 version: rc5-PFD
      JRE: 1.5.0_06
      My persistent queue config:

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

      My MDB class annotated:
      @MessageDriven(activationConfig = {
      @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
      @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/myQueue1"),
      @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Client-acknowledge")
      public class BlogKsgMDBean implements MessageListener {

      I'm using several threads to post messages to myQueue1 simultaneously.
      Looking over my debug log I see that several instances of my MDB also starts simultaneously.
      I would like to get it work to handle messages one by one.
      No get next message from queue until current handle finish.
      But still using MessageListener instead of .receive() method.
      Is it possible? How do I have to configure it?
      Here's how I post message:
      conn = jmsConnectionFactory.createConnection();
      //sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      sess = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
      producer = sess.createProducer((Destination) namingContext.lookup("queue/myQueue1"));
      ObjectMessage msg = sess.createObjectMessage(message);