1 Reply Latest reply on Jan 17, 2008 12:33 PM by Rajeev K

    EJB3 MDB in JBoss 4.0.4 not behaving as per specification

    Rajeev K Newbie

      Hi
      I am using EJB3 MDBs on JBoss 4.0.4 application server. Since the onMessage method takes a lot of time to complete, I was getting the below warning,

      WARN [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=OPGX745-FYKH3D1/1, BranchQual=, localId=1] timed out. status=STATUS_ACTIVE

      So I referred the EJB specs and as per the specs if I make the MDB to not support transaction(TransactionAttributeType.NOT_SUPPORTED) or make it a BMT and set the acknowledgement mode to auto-acknowledge then the message is acknowledged once its delivered to the onMessage method and it does not depend on the BMT transaction in the method.

      I tried both the transaction not supported and the BMT but I still get the above warning and also the message is redelivered.

      Below is the code for the MDB,

      @MessageDriven(activationConfig =
      {
      @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
      @ActivationConfigProperty(propertyName="destination", propertyValue="SonicJMS/Queues/datahub"),
      @ActivationConfigProperty(propertyName="providerAdapterJNDI", propertyValue="java:/SonicJMSProvider"),
      @ActivationConfigProperty(propertyName="useDLQ", propertyValue="false"),
      @ActivationConfigProperty(propertyName="acknowledgeMode", propertyValue="Auto-acknowledge")
      })
      @TransactionManagement(TransactionManagementType.CONTAINER)
      public class FeedParsingManager implements MessageListener {

      @EJB
      private EmailNotification emailSender;

      @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
      public void onMessage(Message msg) {

      ....
      ....
      ....

      }
      }


      The onMessage method calls a stateless session bean which is a BMT. Why am I seeing the warning message and message being redelivered?

      Thanks in advance,
      Rajeev

        • 1. Re: EJB3 MDB in JBoss 4.0.4 not behaving as per specificatio
          Rajeev K Newbie

          I re-tested the whole scenario by removing all of my application logic from the onMessage method and just having a sleep method. What I noticed was irrespective of whether I was using BMT or CMT with NOT_SUPPORTED, I still got the warning message that the transaction has timed out. And also the message was redelivered. Here is the MDB code that I used to test,



          @MessageDriven(activationConfig =
          {
          @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
          @ActivationConfigProperty(propertyName="destination", propertyValue="SonicJMS/Queues/datahub"),
          @ActivationConfigProperty(propertyName="providerAdapterJNDI", propertyValue="java:/SonicJMSProvider"),
          @ActivationConfigProperty(propertyName="useDLQ", propertyValue="false"),
          @ActivationConfigProperty(propertyName="acknowledgeMode", propertyValue="Auto-acknowledge")
          })

          @TransactionManagement(TransactionManagementType.CONTAINER)
          public class FeedParsingManager implements MessageListener {

          @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
          public void onMessage(Message msg) {

          try {
          Thread.sleep(360000);

          } catch (InterruptedException e) {
          e.printStackTrace();
          }

          }

          }

          Thanks,
          rajeev