activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Bish <tim.b...@sensis.com>
Subject Re: Stop Thread / Stop Listening
Date Fri, 26 Oct 2007 16:22:07 GMT
Sure thing.

I've added a SimpleAsyncConsumer and SimplProducer examples to the trunk
of ActiveMQ-CPP.  You can look at these to see example of each in
separate apps. 

Regards
Tim

On Fri, 2007-10-26 at 09:11 -0700, mrh wrote:
> 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
> >> 
> >> 
> >> 
> > 
> > 
> 

Mime
View raw message