Skip to content

JMS message always acknowledged even with CLIENT_ACKNOWLEDGE [SPR-12995] #17587

Closed
@spring-projects-issues

Description

@spring-projects-issues

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:

Metadata

Metadata

Assignees

Labels

in: messagingIssues in messaging modules (jms, messaging)status: declinedA suggestion or change that we don't feel we should currently apply

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions