Is there a standard JMS way that works with all JMS providers to notify a producer that there are new consumers subscribed? I found a way with my SpiritWave provider to do that--I just wait for SubscribtionEvent, but I think this will not work if I change to another JMS provider.

Doug Erickson

No, there's not a standard way to do this at the JMS level.

Typically, a pub/sub system is designed specifically to decouple publishers from subscribers, so that your publishers don't have any knowledge of the subscribers. If your producers really need to know specifics about consumers, pub/sub might not be the right model.

In practice, however, sometimes it's nice to know at least if anyone is out there listening, so that you can save the overhead of message production. To be portable, I think you'd have to implement your own mechanism to do this at the application level.