Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 56358 invoked from network); 26 Oct 2007 14:45:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Oct 2007 14:45:11 -0000 Received: (qmail 7143 invoked by uid 500); 26 Oct 2007 14:44:58 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 7116 invoked by uid 500); 26 Oct 2007 14:44:58 -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 7107 invoked by uid 99); 26 Oct 2007 14:44:58 -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 07:44:58 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [199.105.164.5] (HELO smtpmail2.sensis.com) (199.105.164.5) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Oct 2007 14:45:03 +0000 Received: from dimstar3.ats.sensis.com ([172.21.1.34]) by smtpmail2.sensis.com with esmtp (Exim 4.50) id 1IlQQH-00060O-GE for users@activemq.apache.org; Fri, 26 Oct 2007 10:44:39 -0400 Received: from corpatsmail1.ats.sensis.com ([172.21.1.88] helo=corpatsmail1.corp.sensis.com) by dimstar3.ats.sensis.com with esmtp (Exim 4.63) (envelope-from ) id 1IlQP0-0005Jh-Nj for users@activemq.apache.org; Fri, 26 Oct 2007 10:43:10 -0400 Received: from 172.21.6.29 ([172.21.6.29]) by corpatsmail1.corp.sensis.com ([172.21.1.88]) with Microsoft Exchange Server HTTP-DAV ; Fri, 26 Oct 2007 14:43:09 +0000 Received: from tbish-laptop.ats.sensis.com by corpatsmail1.corp.sensis.com; 26 Oct 2007 10:43:09 -0400 Subject: Re: Stop Thread / Stop Listening From: Timothy Bish To: users@activemq.apache.org In-Reply-To: <13428588.post@talk.nabble.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> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Fri, 26 Oct 2007 10:43:09 -0400 Message-Id: <1193409789.3287.22.camel@tbish-laptop.ats.sensis.com> Mime-Version: 1.0 X-Mailer: Evolution 2.10.3 (2.10.3-4.fc7) X-Sensis-MailScanner-Information: Scanned at Sensis Corporation by MailScanner X-Sensis-MailScanner: Found to be clean X-Sensis-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (not cached, score=-4.419, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.20, BAYES_00 -2.60, CRM114_CHECK -0.21) X-Sensis-MailScanner-From: tim.bish@sensis.com X-Virus-Checked: Checked by ClamAV on apache.org 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 > > >