Return-Path: X-Original-To: apmail-activemq-users-archive@www.apache.org Delivered-To: apmail-activemq-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9D84F103DE for ; Mon, 24 Feb 2014 14:55:41 +0000 (UTC) Received: (qmail 68132 invoked by uid 500); 24 Feb 2014 14:55:39 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 67925 invoked by uid 500); 24 Feb 2014 14:55:38 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 67907 invoked by uid 99); 24 Feb 2014 14:55:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Feb 2014 14:55:37 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of suonayi@gmail.com designates 209.85.215.175 as permitted sender) Received: from [209.85.215.175] (HELO mail-ea0-f175.google.com) (209.85.215.175) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Feb 2014 14:55:33 +0000 Received: by mail-ea0-f175.google.com with SMTP id z10so2822272ead.6 for ; Mon, 24 Feb 2014 06:55:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=TVMTbmsZwSYlap6vrWDsxEdzzjOZIGWc1dXPGHWJgWI=; b=xOkZR1yk3pT5mfnXqY5s/Mkyn20ZVp2tce0k/olRI5liWlmdaWTQGlhE+5mJ4NJYuB 9zRzsSWZK51UE2XZRHJthYWOcXMjn8VkJgcXxHQtWTQFOUYj/K/m8cfOPqMmpXPmXjZ9 Bd7+wJG8h8aenpZCx0DHNbjRPvfeH9azyHUV9Kotn/IuFdRsmJLE6RrmJoTXCyHwEx7x J9ufcTu7SV2VoM2qlzc/Kk6nfmAbvcynJVLLljCsS66R7kLbSskh90TEmsj5GFrTXsHX WPb9DzECNqklmWfULZ/B6K8Y9bRi5hu9apTEG+itHMJB4cAM/9VfzpLpI+cXEeBtmkJG BXKw== MIME-Version: 1.0 X-Received: by 10.15.44.202 with SMTP id z50mr24891955eev.81.1393253712308; Mon, 24 Feb 2014 06:55:12 -0800 (PST) Received: by 10.14.143.76 with HTTP; Mon, 24 Feb 2014 06:55:12 -0800 (PST) In-Reply-To: References: Date: Mon, 24 Feb 2014 22:55:12 +0800 Message-ID: Subject: Re: does AUTO_ACKNOWLEDGE guarantee once and only once semantic for queue consumer? From: Yin Wang To: users@activemq.apache.org Content-Type: multipart/alternative; boundary=089e0160cd229aaf8604f32828d2 X-Virus-Checked: Checked by ClamAV on apache.org --089e0160cd229aaf8604f32828d2 Content-Type: text/plain; charset=UTF-8 Seems what you really want to solve is to distribute real task messages evenly between consumers. As default a consumer has a prefetch to allow broker to push messages to it in batch manner, if a consumer is slow to process message then many pending messages will be accumulated and other consumers may suffer starvation.In this case those real tasks wont get executed in time. You can just use pull mechanism for your consumers so that your consumer can pull real task message from broker one by one. Fast consumers can have a chance to pull more messages than slow consumers. If consumers still can not process real tasks in time, increase consumers or tune performance for consumers. 2014-02-24 19:07 GMT+08:00 Li Li : > I've read the jms specification and questions by google such as > > http://stackoverflow.com/questions/2991412/anyone-know-exactly-which-jms-messages-will-be-redelivered-in-client-acknowledge > . But I still confused about it. > Another question is: how can a consumer tell the broker to > redelevery a message to other consumers(maybe again to this consumer) > e.g. we have some real time tasks and here is code: > class MyConsumer implements MessageListener{ > > public void onMessage(Message msg) { > doPhrase1(); > if(leftTime < avgTime1){ > //Tell broker I can't finish it in time, > //you should redelevery to other consumers > //do some cleanup job > } > doPhrase2(); > if(leftTime < avgTime1){ > //Tell broker I can't finish it in time, > //you should redelevery to other consumers > //do some cleanup job > } > doPhrase3(); > } > --089e0160cd229aaf8604f32828d2--