Thanks Jim and Tim. I managed to hook up a poor-man's recover mechanism. Our
application uses a framework that sits over the various low-level messaging
APIs, such ActiveMQ NMS, Tibco EMS .NET client, and the .NET RabbitMQ
client. So we actually have thin "proxy objects" sitting on top of the
native MessageConsumers and MessageProducers. When we detect a broker
failure, we instantiate a new connection and new sessions, and we recreate
the MessageConsumers and MessageProducers that the application was using.
Not the most elegant solution, but it was accomplished in a few lines of
code and seems to work.

The most difficult thing to do (which is not too difficult, and only
involved finding the correct combination of BindingFlags to use) is to copy
the listener from the old MessageConsumer to the new MessageConsumer. 

    var handler = typeof(MessageConsumer).GetField("listener",
BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.NonPublic |
    newMessageConsumer.Listener += handler;


View this message in context:
Sent from the ActiveMQ - User mailing list archive at

Reply via email to