2008/5/15 Daniel Cohen-Sason <[EMAIL PROTECTED]>:

> In C++, the "SubscriptionManager" allow me to subscribe a listener to
> several queues -
>
> This gives my client the flexibility to dynamically receive messages from
> several queues ["dynamic" because I can dynamically decide, during the
> listener generation, to which queues to "listen"]
>
> Is there an equivalent mechanism here?  [In Java]
> dakash

Yes, you can do this in Java (i.e. JMS) - but do correct me if I have
missed something in your requirement.

You can implement the javax.jms.MessageListener and register it with
however many javax.jms.MessageConsumers you have (you have one
consumer per destination).

So:

MessageListener myListener = createMessageListener(...);
session  = connection.createSession(false,  Session.AUTO_ACKNOWLEDGE);
for (Destination d : destinations)
{
    MesssageConsumer conssumer = session.createConsumer(d);
    consumer.setMessageListener(myListener);
}

connection.start();

I hope that is what you were looking to do.

RG

Reply via email to