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 E788410B2B for ; Thu, 25 Apr 2013 13:55:48 +0000 (UTC) Received: (qmail 90359 invoked by uid 500); 25 Apr 2013 13:55:48 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 89740 invoked by uid 500); 25 Apr 2013 13:55:43 -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 89675 invoked by uid 99); 25 Apr 2013 13:55:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Apr 2013 13:55:41 +0000 X-ASF-Spam-Status: No, hits=0.9 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,RCVD_IN_DNSWL_LOW,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of tabish121@gmail.com designates 209.85.128.51 as permitted sender) Received: from [209.85.128.51] (HELO mail-qe0-f51.google.com) (209.85.128.51) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Apr 2013 13:55:37 +0000 Received: by mail-qe0-f51.google.com with SMTP id 1so2007591qec.24 for ; Thu, 25 Apr 2013 06:55:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=Q3+5ViE3xKmhnJipF+TvtGZlaeQ52bvRmA92HcDMnFo=; b=nNvj55LD0A44tlP75v/4Z7e6nrZ/ll9KZCXMWQxIOWIymlbUBe8PhuMfZ2r6XQ4AwY QmtDqnc1GrTP/OBqZmB7bfZEH+Sq7xXDSLn3RuNmIxblNRWIcsiC1/VxtsVr7mn9Keoh jP8A/Mq9QvO+J0wkJA4047UIOEPVvxWn4CoZiPJJAfXZ/m/dHAXH9g5u/Km+/Xs49Ena Npbc+l+jozxD/PtK4j8DGV+JNWGi25sioj0N8+bH2bPIbkw2Z/Th/NGkWojpQbAX8Y4Q 1XIafRpFQA9H6ebrStpwX8UogWHtCHB2TUBmERdSuHfYiq/+mqTK/UeD6XJ3BzlZejwj 1mMw== X-Received: by 10.229.114.217 with SMTP id f25mr10184084qcq.7.1366898116313; Thu, 25 Apr 2013 06:55:16 -0700 (PDT) Received: from [192.168.2.150] (c-98-218-173-79.hsd1.va.comcast.net. [98.218.173.79]) by mx.google.com with ESMTPSA id do6sm10813107qab.12.2013.04.25.06.55.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Apr 2013 06:55:15 -0700 (PDT) Message-ID: <517935C0.8060101@gmail.com> Date: Thu, 25 Apr 2013 09:55:12 -0400 From: Timothy Bish User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: users@activemq.apache.org Subject: Re: Not receiving all msgs from queue References: <1366887651386-4666192.post@n4.nabble.com> In-Reply-To: <1366887651386-4666192.post@n4.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 On 04/25/2013 07:00 AM, erngarfen wrote: > Hi all, > > I've been struggling with this for a while now, but still can't get my > client to receive all the messages from a queue. I'm using ActiveMQ 5.8.0 as > the broker and ActiveMQ-CPP for the client (see simple test code below). At > the broker I have a queue filled with 1000 messages (done from a separate > python script). When I try to receive these, I usually end up with 575 or > 588 received messages. Trying some combinations of 'prefetch' doesn't help > me either. If I start to acknowledge messages, I'll receive the 1000 > messages. > > I can see in Wireshark that 'MessagePull' is sent to the broker but the > 'MessageDispatch' reply doesn't contain the 'message body'. > > Any help appreciated. > Thanks. > > > #include "activemq/library/ActiveMQCPP.h" > #include "cms/ConnectionFactory.h" > #include "cms/Connection.h" > #include "cms/Session.h" > > #include > > int main() > { > using namespace cms; > using namespace activemq::library; > > ActiveMQCPP::initializeLibrary(); > > ConnectionFactory* lFactory = > ConnectionFactory::createCMSConnectionFactory("tcp://10.178.230.119:61616?jms.prefetchPolicy.queuePrefetch=0"); > Connection* lConnection = lFactory->createConnection(); > Session* lSession = > lConnection->createSession(Session::INDIVIDUAL_ACKNOWLEDGE); > Queue* lQueue = > lSession->createQueue("cmd.queue?consumer.prefetchSize=0"); > MessageConsumer* lConsumer = lSession->createConsumer(lQueue); > > const ConnectionMetaData* lMetaData = lConnection->getMetaData(); > std::cout << "AMQ version=" << lMetaData->getProviderVersion() << > std::endl; > > lSession->start(); > > int lCnt = 0; > while (true) > { > if (Message* lMsg = lConsumer->receive(1000)) > { > std::cout << "Received msg #" << ++lCnt << std::endl; > delete lMsg; > } > } > } > > > > > -- > View this message in context: http://activemq.2283324.n4.nabble.com/Not-receiving-all-msgs-from-queue-tp4666192.html > Sent from the ActiveMQ - User mailing list archive at Nabble.com. > Is your producer blocking be cause its being flow controlled. You aren't acking the messages so space won't be free in memory usage until you do. -- Tim Bish Sr Software Engineer | RedHat Inc. tim.bish@redhat.com | www.fusesource.com | www.redhat.com skype: tabish121 | twitter: @tabish121 blog: http://timbish.blogspot.com/