Exception does not lead to redelivery for AUTO_ACKNOWLEDGE
----------------------------------------------------------
Key: AMQ-906
URL: https://issues.apache.org/activemq/browse/AMQ-906
Project: ActiveMQ
Issue Type: Bug
Affects Versions: 4.0.1
Reporter: Daniel Aioanei
I have a message driven pojo configured configured with with auto_acknowledge,
nontransactional and some persistent message in a queue. All my mdp does it to
throw new RuntimeException("please retry") but unfortunately the messages are
not retried:
SEVERE: error dispatching message:
java.lang.RuntimeException: Please retry
at
net.activem.jms.ExceptionTestOutboundMdp.onMessage(ExceptionTestOutboundMdp.java:46)
at
org.jencks.LocalTransactionEndpoint.onMessage(LocalTransactionEndpoint.java:68)
at
org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.onMessage(MessageEndpointProxy.java:120)
at
org.apache.activemq.ra.MessageEndpointProxy.onMessage(MessageEndpointProxy.java:60)
at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:692)
at
org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:163)
at
org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown
Source)
Looking in the ActiveMQ source code I think the problem might be in these lines:
try {
messageListener.onMessage(message);
} catch ( Throwable e ) {
// TODO: figure out proper way to handle error.
log.error("error dispatching message: ",e);
connection.onAsyncException(e);
}
at java.lang.Thread.run(Thread.java:595)
found in org.apache.activemq.ActiveMQSession.
According to JMS spec, I'd say that with auto_ack a msg should be retried in
case the message listener throws an exception, even if the operation is
non-transactional:
http://java.sun.com/j2ee/1.4/docs/api/javax/jms/Session.html#AUTO_ACKNOWLEDGE
public static final int AUTO_ACKNOWLEDGE
With this acknowledgment mode, the session automatically acknowledges a
client's receipt of a message either when the session has successfully returned
from a call to receive or when the message listener the session has called to
process the message successfully returns.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://issues.apache.org/activemq/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira