0 Replies Latest reply on Oct 28, 2008 9:01 AM by asaf sh

    MessageDriven component stops listening to the queue

    asaf sh Expert

      Hey,

      We have a small EJB3 with a method based on timer that sends JMS messages as follows:

      @Stateless()
      public class ScannerBean implements ScannerLocal {
      @Timeout
      public void sendMessages(Timer timer) {
      InitialContext ctx = new InitialContext();
      queue = (Queue) ctx.lookup("queue/velo/TasksDefaultQueue");
      QueueConnectionFactory factory = (QueueConnectionFactory) ctx.lookup("ConnectionFactory");
      connection = factory.createQueueConnection();
      session = connection.createQueueSession(false,QueueSession.AUTO_ACKNOWLEDGE);
      messageProducer = session.createProducer(queue);
      messageProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      BytesMessage bytesMsg = session.createBytesMessage();
      bytesMsg.setLongProperty("uniqueId", uniqueId);
      messageProducer.send(bytesMsg);
      }
      }
      




      This component seems to work just fine and the messages are successfully stored on the JMS queue.



      We have a very simple MessageDriven bean that listens to a JMS queue as follows:

      @MessageDriven(name="TaskExecuterMessageBean", activationConfig = {
       @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
       @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
       @ActivationConfigProperty(propertyName="destination", propertyValue="queue/velo/TasksDefaultQueue")
      })
      public class MDBTaskExecuter implements MessageListener {
      
      @EJB
      public SomeManager someManager;
      
      @Resource
      private MessageDrivenContext context;
      
      public void onMessage(Message msg) {
       long uniqueId = bm.getLongProperty("uniqueId");
      
       try{
       someManager.process(uniqueId);
       }catch(Exception e) {
       context.setRollbackOnly();
       }
      }
      }
      




      Seems like this MessageDriven component suddenly stops receiving the messages and the queue grows up with not handled messages.

      What may cause the MessageDriven bean suddenly stops working? is it a bug? there are any opened issues about this problem?




      Thanks in advanced,

      Asaf.