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

    MessageDriven component stops listening to the queue

    asaf sh Expert


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

      public class ScannerBean implements ScannerLocal {
      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);
      BytesMessage bytesMsg = session.createBytesMessage();
      bytesMsg.setLongProperty("uniqueId", uniqueId);

      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 {
      public SomeManager someManager;
      private MessageDrivenContext context;
      public void onMessage(Message msg) {
       long uniqueId = bm.getLongProperty("uniqueId");
       }catch(Exception e) {

      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,