|
From: Rod J. <ro...@in...> - 2004-10-28 13:02:01
|
> Regarding pooling of the MessageListener objects: In many cases, this won't be necessary, as the MessageListener implementation will be thread-safe anyway - similar to the DAO and service object case, where a shared singleton instance is fine in 99% of the cases, so there's no need to pool them (like Stateless Session Beans force you to). > > This means that in many cases, there's no need for a pool of listeners, i.e. there's no need to specify a TargetSource as message handler - a plain target object will do, specified as shared MessageListener bean. > > If there's an actual need to pool those target listeners, this could always be achieved through a ProxyFactoryBean with a pooling TargetSource, with the proxy implementing the MessageListener interface: >From the point of view of the ActiveMQ message dispatcher, it would simply keep calling the shared MessageListener onMessage method, but this time on the proxy which will delegate to one of the instances in its backend pool. Indeed. Transparent, and enabling the simplest thing that can possibly work. We shouldn't slip into EJB-think--"pooling is always necessary". R |