Author: gsim Date: Fri Oct 10 12:59:15 2014 New Revision: 1630876 URL: http://svn.apache.org/r1630876 Log: PROTON-704: subtract 1 when setting delivery-count header based on JMSXDeliveryCount during outbound JMS transformation
Modified: qpid/proton/branches/examples/contrib/proton-jms/src/main/java/org/apache/qpid/proton/jms/JMSMappingOutboundTransformer.java Modified: qpid/proton/branches/examples/contrib/proton-jms/src/main/java/org/apache/qpid/proton/jms/JMSMappingOutboundTransformer.java URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/contrib/proton-jms/src/main/java/org/apache/qpid/proton/jms/JMSMappingOutboundTransformer.java?rev=1630876&r1=1630875&r2=1630876&view=diff ============================================================================== --- qpid/proton/branches/examples/contrib/proton-jms/src/main/java/org/apache/qpid/proton/jms/JMSMappingOutboundTransformer.java (original) +++ qpid/proton/branches/examples/contrib/proton-jms/src/main/java/org/apache/qpid/proton/jms/JMSMappingOutboundTransformer.java Fri Oct 10 12:59:15 2014 @@ -166,7 +166,12 @@ public class JMSMappingOutboundTransform } else if( key.equals(firstAcquirerKey) ) { header.setFirstAcquirer(msg.getBooleanProperty(key)); } else if( key.startsWith("JMSXDeliveryCount") ) { - header.setDeliveryCount(new UnsignedInteger(msg.getIntProperty(key))); + // The AMQP delivery-count field only includes prior failed delivery attempts, + // whereas JMSXDeliveryCount includes the first/current delivery attempt. + int amqpDeliveryCount = msg.getIntProperty(key) - 1; + if( amqpDeliveryCount > 0 ) { + header.setDeliveryCount(new UnsignedInteger(amqpDeliveryCount)); + } } else if( key.startsWith("JMSXUserID") ) { String value = msg.getStringProperty(key); props.setUserId(new Binary(value.getBytes("UTF-8"))); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org