[jboss-user] [EJB 3.0] - EJB3 MESSAGE DRIVEN BEAN WORKS ONCE & NEVER AGAIN UNTIL JBOS

pjr444 do-not-reply at jboss.com
Thu Feb 5 14:18:54 EST 2009


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 at 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




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4207467#4207467

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4207467



More information about the jboss-user mailing list