A Publisher publishes a message on a topic. You have n dynamic listeners (n is not known until runtime & shrinks and grows during runtime). How do you dynamically subscribe to this topic in EJB 2.0? Based upon my understanding, MDB will not work because I need to know the number of pools to configure via the deployment descriptor. If I use one pool, then MDB's would have to serially redistribute the message to the n desired listeners. If n is large, this solution does not scale and this technique favors one listener over another. In addition, if ordering of messages is important, the pool size must be set to one, which again introduces the scalability issues motioned above.
If I attempt to solve this issue using a non-MDB approach, i.e. a Proxy object to subscribe on behalf of each listener, I then lose all benefits of the application server most importantly Fault Tolerance and Fail Over.
Is there a pattern or technique I should research to help solve this issue?