Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 52215 invoked from network); 12 Jun 2008 21:50:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Jun 2008 21:50:54 -0000 Received: (qmail 45067 invoked by uid 500); 12 Jun 2008 21:50:55 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 45051 invoked by uid 500); 12 Jun 2008 21:50:55 -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 45040 invoked by uid 99); 12 Jun 2008 21:50:55 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Jun 2008 14:50:55 -0700 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Jun 2008 21:50:05 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1K6ugY-0002pv-1o for users@activemq.apache.org; Thu, 12 Jun 2008 14:50:22 -0700 Message-ID: <17810453.post@talk.nabble.com> Date: Thu, 12 Jun 2008 14:50:22 -0700 (PDT) From: drjava To: users@activemq.apache.org Subject: Re: Lost messages - not all messages sent to the queue are delivered to the message receiver In-Reply-To: <2e6260670806121033l3996eb6cxff1dc7bfd7dba17d@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: nabble@zippersnapper.com References: <17804229.post@talk.nabble.com> <2e6260670806121033l3996eb6cxff1dc7bfd7dba17d@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org Thanks, Dave! It seems as though the cacheLevel setting did the trick. The pooled connection factory on the other hand resulted in no messages arriving on the receiver side. I admit that I was too lazy to find out if they had arrived at the queue at all. (Again I trust the JmsTemplate to report of an exception had this happened) Instead I just reverted back to the org.springframework.jms.connection.SingleConnectionFactory. And now the test passes. Dave Stanley wrote: > > I think this may be a problem on the consumer side given you are using the > Spring DMLC with no connection caching. The connection will be recycled > each time, but this can cause problems if your prefetch policy is not > aligned. > > Try using a pooled connection factory, also try and set the DMLC > cacheLevel > to CACHE_CONSUMER ("3") > > class="org.apache.activemq.pool.PooledConnectionFactory" > destroy-method="stop"> > > > > > > > > > > class="org.springframework.jms.listener.DefaultMessageListenerContainer"> > .... > > .... > > > HTH > /Dave > > On Thu, Jun 12, 2008 at 12:33 PM, drjava wrote: > >> >> I am using ActiveMQ embedded in my Junit test. >> I have a JmsMessenger that uses a JmsTemplate to send the messages and a >> MessageReceiver to receive the messages. >> The test goal is to verify that all messages that were sent were also >> received (compare numbers and the actual message objects for equality). >> >> How it works: send out 100 unique messages (using a >> SingleConnectionFactory) >> . >> The MessageReceiver intercepts them and collects them in a List. >> Compare that the total received and sent are equal. >> Compare the received list's items to the sent ones, make sure the >> messages >> did not get corrupted. >> >> However, on each and every run the test fails on the first assertion - >> comparing the total sent and received numbers. >> >> Moreover this - on each run the total received number is different. >> (after >> sending is complete the main thread awaits for 1 minute, which I consider >> a >> long enough time to intercept 100 messages, so that the receiver gets the >> opportunity to catch up) >> >> According to the JmsTemplate all messages are successfully sent (the call >> to >> convertAndSend is surrounded by a try/catch block and no JmsException is >> being caught). >> >> Emvironment details: >> IDE - eclipse 3.3.2 >> test runner - Junit 4.4 >> ActiveMQ version - 5.1.0 >> VM - Java 1.6_0_06 >> OS - Windows XP 64bits >> hardware - Dell Intel dual core, 2.66GH, 3.93 GB of RAM >> >> Perhaps I don't fully understand how to best use Active MQ embedded in my >> test. Are there any special settings of the broker's properties I should >> exercise? >> >> I am attaching a few files to support understanding of my test scenario: >> >> spring-config.xml (this configures the jms template and the message >> receiver >> and jms messenger and all the rest) >> http://www.nabble.com/file/p17804229/spring-config.xml spring-config.xml >> >> JmsMessengerTest.java the test class >> http://www.nabble.com/file/p17804229/JmsMessengerTest.java >> JmsMessengerTest.java >> >> MessageReceiver.java >> http://www.nabble.com/file/p17804229/MessageReceiver.java >> MessageReceiver.java >> >> JmsLogMessenger.java >> http://www.nabble.com/file/p17804229/JmsLogMessenger.java >> JmsLogMessenger.java >> -- >> View this message in context: >> http://www.nabble.com/Lost-messages----not-all-messages-sent-to-the-queue-are-delivered-to-the-message-receiver-tp17804229p17804229.html >> Sent from the ActiveMQ - User mailing list archive at Nabble.com. >> >> > > -- View this message in context: http://www.nabble.com/Lost-messages----not-all-messages-sent-to-the-queue-are-delivered-to-the-message-receiver-tp17804229p17810453.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.