users@glassfish.java.net

MDB message TTL and afterDelivery log spam

From: <glassfish_at_javadesktop.org>
Date: Fri, 25 Jun 2010 08:49:10 PDT

I've got message producer that far outpaces my MDB's consumption of the messages, but it's not critical that all messages get processed. The messages are essentially batches of status updates that get sent several times a minute. The easy solution to this was to setTimeToLive of the message to 1min. The problem is that the messages (batches) can take more then a minute to process. I'm thinking that in the time they're processing the broker has expired the message so that the auto-acknowledge from the MDB doesn't have a corresponding message in the queue and this exception is thrown:

javax.ejb.EJBException
javax.ejb.EJBException: Transaction aborted; nested exception is: javax.transaction.RollbackException
javax.transaction.RollbackException
        at com.sun.jts.jta.TransactionManagerImpl.commit(TransactionManagerImpl.java:311)
        at com.sun.enterprise.distributedtx.J2EETransactionManagerImpl.commit(J2EETransactionManagerImpl.java:1003)
        at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.commit(J2EETransactionManagerOpt.java:398)
        at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3817)
        at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3596)
        at com.sun.ejb.containers.MessageBeanContainer.afterMessageDeliveryInternal(MessageBeanContainer.java:1226)
        at com.sun.ejb.containers.MessageBeanContainer.afterMessageDelivery(MessageBeanContainer.java:1197)
        at com.sun.ejb.containers.MessageBeanListenerImpl.afterMessageDelivery(MessageBeanListenerImpl.java:79)
        at com.sun.enterprise.connectors.inflow.MessageEndpointInvocationHandler.invoke(MessageEndpointInvocationHandler.java:139)
        at $Proxy38.afterDelivery(Unknown Source)
        at com.sun.messaging.jms.ra.OnMessageRunner.run(OnMessageRunner.java:324)
        at com.sun.enterprise.connectors.work.OneWork.doWork(OneWork.java:76)
        at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
javax.ejb.EJBException: Transaction aborted; nested exception is: javax.transaction.RollbackException
        at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3823)
        at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3596)
        at com.sun.ejb.containers.MessageBeanContainer.afterMessageDeliveryInternal(MessageBeanContainer.java:1226)
        at com.sun.ejb.containers.MessageBeanContainer.afterMessageDelivery(MessageBeanContainer.java:1197)
        at com.sun.ejb.containers.MessageBeanListenerImpl.afterMessageDelivery(MessageBeanListenerImpl.java:79)
        at com.sun.enterprise.connectors.inflow.MessageEndpointInvocationHandler.invoke(MessageEndpointInvocationHandler.java:139)
        at $Proxy38.afterDelivery(Unknown Source)
        at com.sun.messaging.jms.ra.OnMessageRunner.run(OnMessageRunner.java:324)
        at com.sun.enterprise.connectors.work.OneWork.doWork(OneWork.java:76)
        at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)

Since, this is a MDB my acknowledge-mode options are limited (I think). So, my second attempt to fix the spamming was to "msg.setJMSExpiration(0);" in the first line of onMessage. Didn't work. Any suggestions?
[Message sent by forum member 'rjg71']

http://forums.java.net/jive/thread.jspa?messageID=475839