You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2015/05/07 18:27:01 UTC

[jira] [Resolved] (CAMEL-8749) JMS message always acknowledged even with CLIENT_ACKNOWLEDGE

     [ https://issues.apache.org/jira/browse/CAMEL-8749?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-8749.
--------------------------------
    Resolution: Not A Problem
      Assignee: Claus Ibsen

As the response from Juergen Holler its by design how spring-jms works.

For using client ack mode, you should use spring jms teamplate, or write jms code yourself etc.

> JMS message always acknowledged even with CLIENT_ACKNOWLEDGE
> ------------------------------------------------------------
>
>                 Key: CAMEL-8749
>                 URL: https://issues.apache.org/jira/browse/CAMEL-8749
>             Project: Camel
>          Issue Type: Wish
>          Components: camel-jms
>            Reporter: Thomas Diesler
>            Assignee: Claus Ibsen
>             Fix For: 2.16.0
>
>
> 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
> CrossRef: https://jira.spring.io/browse/SPR-12995



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