Hi,
I'm using AdvisoryConsumer in my MessageProducer to listen to the consumers
activities. On a consumer shutdown, I would want to perform some cleanup
job. Below is the code:
Topic advisoryTopic = AdvisorySupport
.getConsumerAdvisoryTopic((ActiveMQDestination)
JMSConnection.getInstance().getTopic());
MessageConsumer advisoryConsumer =
JMSConnection.getInstance().getSession().createConsumer(advisoryTopic);
advisoryConsumer.setMessageListener(new MessageListener() {
public void onMessage(Message message) {
if (message instanceof ActiveMQMessage) {
ActiveMQMessage aMsg = (ActiveMQMessage) message;
DataStructure dataStructure = aMsg.getDataStructure();
if (dataStructure instanceof ConsumerInfo) {
System.out.println("Consumer started, ConsumerInfo
:" + message.toString());
...
} else if (dataStructure instanceof RemoveInfo) {
RemoveInfo removeInfo = (RemoveInfo) dataStructure;
DataStructure objectId = removeInfo.getObjectId();
System.out.println("Consumer stopped, ConsumerInfo
:" + message.toString());
// do some clean up
}
}
}
});
RemoveInfo command, exposes the consumerId (some magic string consisting of
connection id, session id and some long value), is there a way to find the
subscription name that is specified while creating the consumer using the
consumer id that is available to me? Or any other work around where I could
clearly identify who is the consumer who is dead?
Any help w.r.t this would be highly appreciated.
Thanks!
--
View this message in context:
http://old.nabble.com/AdvisoryConsumer-tp28409087p28409087.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.