0 Replies Latest reply on Feb 5, 2009 2:18 PM by pjr444

    EJB3 MESSAGE DRIVEN BEAN WORKS ONCE & NEVER AGAIN UNTIL JBOS

    pjr444

      Hi.

      I've been using a simple Message Driven Bean to grab new emails from an imap account for the last 18 months very successfully on 4.2.1 AS

      Bean code :


      import javax.ejb.ActivationConfigProperty;
      import javax.ejb.MessageDriven;
      import javax.mail.Message;
      import javax.persistence.EntityManager;
      import javax.persistence.PersistenceContext;

      import org.jboss.annotation.ejb.ResourceAdapter;
      import org.jboss.resource.adapter.mail.inflow.MailListener;

      /**
      * EJB3 Message-Driven Bean (MDB).
      * Called for every email received to an IMAP account
      *
      */
      @MessageDriven(activationConfig={
      @ActivationConfigProperty(propertyName="mailServer", propertyValue="mail.philips.local"),
      // @ActivationConfigProperty(propertyName="port", propertyValue="10143"),
      @ActivationConfigProperty(propertyName="mailFolder", propertyValue="INBOX"),
      @ActivationConfigProperty(propertyName="storeProtocol", propertyValue="imap"),
      @ActivationConfigProperty(propertyName="userName", propertyValue="anemailadd@somewhere.org.uk"),
      @ActivationConfigProperty(propertyName="password", propertyValue="????????"),
      @ActivationConfigProperty(propertyName="debug", propertyValue="false"),
      @ActivationConfigProperty(propertyName="pollingInterval", propertyValue="30000"),
      @ActivationConfigProperty(propertyName="maxMessages", propertyValue="5")
      })
      @ResourceAdapter("mail-ra.rar")

      public class ReceiverMDB implements MailListener
      {
      @PersistenceContext(unitName = "default")
      private EntityManager em;

      public void onMessage(Message msg)
      {
      ReceiveTools.receiveForm(msg, em);
      }

      (NOTE : I believe 'maxMessages' is ignored, so doesn't do anything)

      Recently, we have been doing some testing on upgrading to 4.2.3 and something seems to be effecting this bean on our live server - Now when JBoss starts the bean triggers once and will happily devour 450 emails. But once it's finished getting the first block of pending emails, it never triggers again.
      There's no exceptions. The bean's 'onMessage' never seems to get triggered. Even going onto the JBoss Console and stopping/starting/destroying/creating etc doesn't get the bean working.

      Worse still going back to 4.2.1 doesn't seem to help. And only restarting JBoss clears the pending emails.

      Does anyone have experience of similar issues with MDBs, especially with the mail-ra.rar resource? Or can anyone help?

      THANKS