Hi mzo, To do what you want to do I did a conditional mutex over a concurrent access queue.
If you want to take a look of my code: https://code.google.com/p/activeinterface/source/browse/#svn%2FActiveInterface%2Fsrc%2Fcore%2Fwrapper <https://code.google.com/p/activeinterface/source/browse/#svn%2FActiveInterface%2Fsrc%2Fcore%2Fwrapper>take a look of the ActiveProducer class, that has a ActiveProducerThread class. regards 2011/3/7 Timothy Bish <tab...@fusesource.com> > On Mon, 2011-03-07 at 09:28 +0100, m...@domdv.de wrote: > > Hello Timothy, > > > > > Creating a Consumer object and registering a MessageListener will > result > > > in messages being received in a separate thread, so there's not really > > > any need to create a new thread for your consumer. > > > > That explains the count of threads upon debugging. I already thought that > > may be the case, but its good to have it confirmed. > > > > > This is commonly done using a Blocking Queue, the producer thread waits > > > on something being enqueued and once it is, it dequeues it and does > > > whatever work is needed. > > > > But with a queue there would be a problem that if a subscriber gets > > offline due networking reasons, the messages would stack until a memory > > error occurs, or? > > > > And with a "Blocking Queue" you mean simply a sync Queue or? Are there > > samples for this? > > A sync Q yes. You look at the MessageDispatchChannel classes in the src > bundle for an idea of how you might implement something that fits your > requirements. > > Regards > > -- > Tim Bish > ------------ > FuseSource > Email: tim.b...@fusesource.com > Web: http://fusesource.com > Twitter: tabish121 > Blog: http://timbish.blogspot.com/ > > > -- Óscar Pernas Plaza.