Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 89657 invoked from network); 26 Oct 2007 16:12:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Oct 2007 16:12:22 -0000 Received: (qmail 65455 invoked by uid 500); 26 Oct 2007 16:12:09 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 65430 invoked by uid 500); 26 Oct 2007 16:12:09 -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 65421 invoked by uid 99); 26 Oct 2007 16:12:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Oct 2007 09:12:09 -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 (nike.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; Fri, 26 Oct 2007 16:12:13 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1IlRmp-00005W-3d for users@activemq.apache.org; Fri, 26 Oct 2007 09:11:51 -0700 Message-ID: <13430289.post@talk.nabble.com> Date: Fri, 26 Oct 2007 09:11:51 -0700 (PDT) From: mrh To: users@activemq.apache.org Subject: Re: Stop Thread / Stop Listening In-Reply-To: <1193409789.3287.22.camel@tbish-laptop.ats.sensis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: mrhaygood@gmail.com References: <13415697.post@talk.nabble.com> <8a6feb940710251409s30ca00d9td71a0625f675fe70@mail.gmail.com> <13427708.post@talk.nabble.com> <1193408417.3287.19.camel@tbish-laptop.ats.sensis.com> <13428588.post@talk.nabble.com> <1193409789.3287.22.camel@tbish-laptop.ats.sensis.com> X-Virus-Checked: Checked by ClamAV on apache.org That is exactly what I needed to know. I misunderstood what the donelatch.await() line of code did in the activemq-example project. I could not figure out why the entire program kept exiting when that line of code wasn't in there. Now I see that if no other processing is taking place, the program exits without stopping the consumer correctly, which throws an exception. Now I'm starting to understand. Thanks again for all of the assistance! mrh tabish121 wrote: > > When you use a MessageListener that listener is notified in a thread > context other than the main thread. So in you client app you can set a > MessageListener and then it will receive messages until you kill the > app, so you can just have the main waiting on a cin.get() and it will > process message until you hit a key. > > Regards. > Tim. > > On Fri, 2007-10-26 at 07:36 -0700, mrh wrote: >> Thank you for the reply, Tim. >> >> Yes, this is my primary question: >> >> >> tabish121 wrote: >> > >> > make that it >> > doesn't wait forever for messages and it stops as soon as it gets all >> > the messages we told it to. >> > >> >> I would like for it to listen continuously for messages: no countdown, no >> wait... just listen in the background while allowing the user to do other >> things, until the user wants to exit the entire application. Is the only >> way to do this with threads? >> >> Thanks again, >> mrh >> >> >> >> On Fri, 2007-10-26 at 06:49 -0700, mrh wrote: >> > In the activemq-cpp example code, there is a countdown "latch". If I >> > understand it correctly, you can pass in a number of milliseconds that >> it >> > is >> > to wait for a message or a number that it will count down to as >> messages >> > are >> > received. With this structure, is it possible to asychronously receive >> > messages (using the onMessage function to process them) but stop the >> > listener from the outside? Say, from an outside thread? >> > >> > Thanks, >> > mrh >> >> >> > > -- View this message in context: http://www.nabble.com/Stop-Thread---Stop-Listening-tf4693571s2354.html#a13430289 Sent from the ActiveMQ - User mailing list archive at Nabble.com.