camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Diesler (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CAMEL-8749) JMS message always acknowledged even with CLIENT_ACKNOWLEDGE
Date Wed, 06 May 2015 15:20:00 GMT
Thomas Diesler created CAMEL-8749:
-------------------------------------

             Summary: JMS message always acknowledged even with CLIENT_ACKNOWLEDGE
                 Key: CAMEL-8749
                 URL: https://issues.apache.org/jira/browse/CAMEL-8749
             Project: Camel
          Issue Type: Bug
          Components: camel-jms
            Reporter: Thomas Diesler


On a JMS message consumer route, we support

{code}
jms:...&acknowledgementModeName=CLIENT_ACKNOWLEDGE
{code}

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

{code}
	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();
		}
	}
{code}

This would not be correct if the route is the JMS client. Redelivery can only be achieved
in the context of one message invocation




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message