From users-return-14813-apmail-activemq-users-archive=activemq.apache.org@activemq.apache.org Fri Jul 04 19:32:18 2008 Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 19400 invoked from network); 4 Jul 2008 19:32:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Jul 2008 19:32:18 -0000 Received: (qmail 40826 invoked by uid 500); 4 Jul 2008 19:32:18 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 40807 invoked by uid 500); 4 Jul 2008 19:32:18 -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 40796 invoked by uid 99); 4 Jul 2008 19:32:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Jul 2008 12:32:18 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [72.22.94.67] (HELO virtual.halosg.com) (72.22.94.67) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Jul 2008 19:31:26 +0000 Received: (qmail 10170 invoked from network); 4 Jul 2008 14:30:46 -0500 Received: from pat.symcor.com (HELO ?10.249.33.133?) (205.189.242.100) by halosg.com with SMTP; 4 Jul 2008 14:30:46 -0500 Message-ID: <486E7AB3.7090603@hanik.com> Date: Fri, 04 Jul 2008 15:32:03 -0400 From: Filip Hanik - Dev Lists User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 To: users@activemq.apache.org Subject: Re: PrefetchSize doesn't work. References: <18263153.post@talk.nabble.com> In-Reply-To: <18263153.post@talk.nabble.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org it works if you specify it on both ends, so you have the client correct, on the server you need to specify it too Filip fl wrote: > Hello, > > I have trouble with disabling prefetch buffer for consumers. I made simple > test. > > This is my configuration (i tried the same with values = 0): > ConnectionFactory connectionFactory = new > ActiveMQConnectionFactory("tcp://localhost:61616?jms.prefetchPolicy.all=1&jms.optimizeMessageDispatch=false"); > Destination destination = new > ActiveMQQueue("queue.TEST?consumer.prefetchSize=1"); > > There is one producer (Producer) and two consumers (ConsumerA, ConsumerB). > All consumers and producers are connected to the same queue 'destination'. > All consumers and producers are created at begin of the test. So before > Producer send a any message, both consumers are ready for receiving > messages. MessageConsumer#receive() method is used for receiving. > > At this point, Producer send 10 messages. Then ConsumerA tries to get as > much messages as possible from queue, and it gets 5 messages. Then ConsumerB > tries to get as much messages as possible from queue, and it gets 5 messages > too. > My question is: why ? :) > > I expected that 9 messages will be consumed by ConsumerA and 1 message by > ConsumerB. Instead, its looks like ConsumerB blocks 5 messages for itself, > when it should be able to block only one message (according to > prefetchSize). > I tried various combination with these three parameters showed above and it > is always the same behavior. > > I check 'PrefetchSize' for these subscriptions via JMX console just before > any receiving (so there were 10 messages in queue). > 'PrefetchSize' was set to 1 for both subscriptions. It was strange because > 'PendingQueueSize' for these subscriptions was set to 4. It looks like 1 > message in prefetch cache and 4 messages in pending queue gives our 5 > messages that were blocked by ConsumerB. > > And two additional question: > 1) 'PendingQueue' - what it actually is ? > 2) Is there any way to set these parameters in xml configuration file? So > all ConnectionFactory'ies created without explicitly overwriting will use > values from xml. > > BR, > Lucas >