Description
Thomas Diesler opened SPR-12995 and commented
On a JMS message consumer route, we support
jms:...&acknowledgementModeName=CLIENT_ACKNOWLEDGE
The pattern is that a client may chose to process a batch of msgs before it acks. If batch processing succeeds the client calls Message.acknowledge(). If it fails, the client may choose to recover the msgs in the batch with Session.recover()
In a Processor we can now call Message.acknowledge() or Session.recover(). However, even if the route (i.e. the client) does not call Message.acknowledge() it is called automatically in org.springframework.jms.listener.AbstractMessageListenerContainer
protected void commitIfNecessary(Session session, Message message) throws JMSException {
// Commit session or acknowledge message.
if (session.getTransacted()) {
// Commit necessary - but avoid commit call within a JTA transaction.
if (isSessionLocallyTransacted(session)) {
// Transacted session created by this container -> commit.
JmsUtils.commitIfNecessary(session);
}
}
else if (message != null && isClientAcknowledge(session)) {
message.acknowledge();
}
}
This would not be correct if the route is the JMS client. Redelivery can only be achieved in the context of one message invocation
CrossRef: https://issues.apache.org/jira/browse/CAMEL-8711
Affects: 4.1.6
Issue Links:
- CLIENT_ACKNOWLEDGE with JmsTemplate - implicit message acknowledge each read [SPR-13255] #17846 CLIENT_ACKNOWLEDGE with JmsTemplate - implicit message acknowledge each read