> 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/



Reply via email to