All you need to do is close the consuer, i.e. myConsumer.close() and it won't receive any more messages. That is if you only want to stop that consumer. Otherwise if you are shutting down the app then close and delete everything.
Regards Tim. On Fri, 2007-10-26 at 07:51 -0700, mrh wrote: > In other words, if the asynchronous listener is listening "forever", is it > possible to neatly stop that listener by closing the connection, the > session, the consumer, etc? > > --mrh > > > 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 > > > > > > >