Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 88190 invoked from network); 3 Jul 2008 07:10:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Jul 2008 07:10:51 -0000 Received: (qmail 94826 invoked by uid 500); 3 Jul 2008 07:10:52 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 94802 invoked by uid 500); 3 Jul 2008 07:10:52 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 94791 invoked by uid 99); 3 Jul 2008 07:10:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Jul 2008 00:10:52 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Jul 2008 07:10:09 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 7CFCA234C14F for ; Thu, 3 Jul 2008 00:10:00 -0700 (PDT) Message-ID: <1462633035.1215069000510.JavaMail.jira@brutus> Date: Thu, 3 Jul 2008 00:10:00 -0700 (PDT) From: "Dmitry Tsigelnik (JIRA)" To: dev@activemq.apache.org Subject: [jira] Commented: (AMQ-1730) Bad use of Jms field JMSXDeliveryCount. Related to RedeliveryCount and message prefetch In-Reply-To: <341800037.1210858843452.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/activemq/browse/AMQ-1730?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43882#action_43882 ] Dmitry Tsigelnik commented on AMQ-1730: --------------------------------------- I've invented problem and I thnink the problem is absence of command like RollabckCommand which could increment redelivery counter on server. It think it should be added something like RollbackCommand and session.sendRollback(rollbackCommand) as like as sesssion.sendAck(ack) > Bad use of Jms field JMSXDeliveryCount. Related to RedeliveryCount and message prefetch > ---------------------------------------------------------------------------------------- > > Key: AMQ-1730 > URL: https://issues.apache.org/activemq/browse/AMQ-1730 > Project: ActiveMQ > Issue Type: Bug > Components: Broker > Affects Versions: 5.0.0, 5.1.0 > Reporter: Alexis Kinsella > Assignee: Rob Davies > > JMSXDeliveryCount has to be incremented only on transactional delivery failure ( RuntimeException on processing message, ... ). > JMSXDeliveryCount is actualy used in correlation with Message.java field: 'redeliveryCounter'. > But RedeliveryCounter field is used to be incremented each time the message is preteched or sent to a consumer => It does not mean that message has been processed by business in transaction with a failure. It just has been prefetched by consumer ou subscriber. > A 'not consumed message' can be give back to the broker when the consumer is closed by user, because it has been prefetched but not really consumed! > It does not match the meaning of the JMS field JMSXDeliveryCount : > "If a failure occurs within transactional processing then the JMSXDeliveryCount is incremented". > JMSXDeliveryCount field only has to be incremented on rollback (isn't it? ). This is why Message.redeliveryCount can not be used. Or the behavour of field Message.redeliveryCount has to be changed. > You can either : > * create a new counter on message incremented only on rollback, or > * modify classes : PrefetchSubscription.java and Queue.java to remove redeliveryCount increment and increment it only on rollback. > * PrefetchSubscription.java: > if (inAckRange) { > // node.incrementRedeliveryCounter(); > if (ack.getLastMessageId().equals(messageId)) { > destination = node.getRegionDestination(); > callDispatchMatched = true; > break; > } > } > * Queue.java: > for (MessageReference ref : sub.remove(context, this)) { > QueueMessageReference qmr = (QueueMessageReference)ref; > // qmr.incrementRedeliveryCounter(); > if( qmr.getLockOwner()==sub ) { > qmr.unlock(); > // if (!qmr.isDropped() && !qmr.isAcked()) { > // qmr.incrementRedeliveryCounter(); > // } > } > list.add(qmr); > } > BTW, In this code it seems there is a second bug, in case of test "qmr.getLockOwner()==sub" is true qmr is incremented a second time ?! Is it right ? > The result of this problem is the following: > With Spring and DefaultMessageListenerContainer, a message is consumed one by one. This is why a message prefteched many times, on first real consuming has a JMSXDeliveryCount with high value not reflecting the reality. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.