Hi Timothy I'm now able to deal with connection interruptions on the sending side but seem to get some problems on the receiving side (there are some partner that simple just receive messages)
What I currently do is (in pseudocode) Consumer c = session.createConsumer(SomeDestination) while(true) { Message m = c.receiveTimeout(1Second) if(m != Void){ doSomething() } } Now my problem seems to be that, "c.receive" doesn't throw an exception if the connection is lost and therefore I'm not able to detect the lost connection. Thanks again for your helpful advice Patrick Timothy Bish wrote: > > >> Now to the second part of my question: >> What is the recommended way to deal with multiple threads? Should I use >> the >> SessionPool? Or should I share one session and protect it? Any hints how >> to >> best deal with recreating the resources? > > We've made every attempt to make the classes in CMS thread safe, so you > could share one session amongst many threads. Probably the best thing > todo is hide the actual CMS code behind some sort of Proxy object that > you give to each of your threads that provides the functionality that > they need to send their messages, then in the proxy you could monitor > the Connection for exceptions using an exception listener and destroy > and recreate all the resources that you did initially while locking > something like a mutex that prevents your producers from publishing > anything while you are reconnecting. > > Once 3.0 is done all of that should become transparent to the user if > they use the Failover Transport. But until then you could do something > like I described to make it work for now. > > SessionPool is really only intended for use in the CMSTemplate code, not > in your own code. > > Regards > Tim. > > > > -- > Tim Bish > http://fusesource.com > http://timbish.blogspot.com/ > > > > > -- View this message in context: http://www.nabble.com/Real-world-example-for-CMS--tp21537664p21552500.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.