You could have a little camel route listen on the broker for the ActiveMQ.Advisory.Connection advisory topic and see when the client goes away. Then if it does, broadcast a message out to the clients that are interested in this information.
http://activemq.apache.org/advisory-message.html On Wed, Jul 9, 2014 at 4:51 AM, nauman73 <[email protected]> wrote: > Hi > > I was handed over an ActiveMQ related development project recently. I do > not > have lot of background knowledge on ActiveMQ so I may not explain my > question in exact ActiveMQ terminology. > > We have a network of brokers where one broker is acting as the publisher > and > the other is acting as subscriber. The publisher transport connector is > declared as follows in activemq.xml. > > <transportConnectors> > <transportConnector name="openwire" uri="tcp://0.0.0.0:61616" > updateClusterClients="false" rebalanceClusterClients="false" > updateClusterClientsOnRemove="true"/> > </transportConnectors> > > On the subscriber side the network connector and transport connector are > declared as follows. The {othernode} in network connector is replaced with > publisher machine IP during deployment. > > <networkConnectors> > <networkConnector name="Broker12Bridge" userName="system" > password="manager" > uri="static:(tcp://${othernode}:61616)" duplex="true" prefetchSize="100"/> > </networkConnectors> > > <transportConnectors> > <transportConnector name="openwire" uri="tcp://0.0.0.0:61616" > updateClusterClients="false" rebalanceClusterClients="false" > updateClusterClientsOnRemove="true"/> > </transportConnectors> > > We are using ActiveMQ-CPP in the client application code to make connection > with local ActiveMQ. We have a client application on the publisher machine > and a client application on the subscriber machine. Both clients create a > producer, a durable consumer and a non-durable consumer on local ActiveMQ. > Both clients register the same topic (i.e. EEP) so both can exchange > messages with each other in both directions. > > In addition, both clients also create a consumer for the > "ActiveMQ.Advisory.Connection" advisory messages. The aim of the advisory > messages consumer is to get the intimation in case the broker or the client > application on the opposite machine has disconnected. This allows us to > handle some failover tasks. > > We are able to get the advisory messages when the opposite machine shuts > down or gets unplugged from network. However, we also need to know if the > client application on other machine has crashed for some reason. We do have > a mechanism to intimate the opposite machine client in case of a graceful > shutdown of one machine client application (i.e. before shutdown the client > application sends a status message to the ActiveMQ topic, and this message > is received by the client application on opposite machine). But in case of > a > crash of client application on one machine, the client on opposite machine > does not get any intimation from ActiveMQ of that machine. However, in the > ActiveMQ logs of opposite machine, I can see that the ActiveMQ does know > about crash of client application. In the ActiveMQ logs, I see following > log > when the client crashes. > > 2014-07-09 16:47:53,719 | DEBUG | static-broker2 removing interest in sub > on > vm://static-broker2#0 from static-broker1 : sub: > ID:PAK-W2012R2-NH1-62609-1404905690709-0:0:0:0 existing matched sub: > ConsumerInfo {commandId = 0, responseRequired = false, consumerId = > ID:PAK-W2012R2-NH2-51238-1404905790383-2:2:1:1, destination = topic://EEP, > prefetchSize = 0, maximumPendingMessageLimit = 0, browser = false, > dispatchAsync = false, selector = null, subscriptionName = null, noLocal = > false, exclusive = false, retroactive = false, priority = 0, brokerPath = > null, optimizedAcknowledge = false, noRangeAcks = false, > additionalPredicate > = null} | org.apache.activemq.network.ConduitBridge | ActiveMQ Transport: > tcp://PAK-W2012R2-NH1/10.110.22.32:61616 > > I registered for some other available advisory topics > "ActiveMQ.Advisory.Consumer.Topic.EEP", > "ActiveMQ.Advisory.Producer.Topic.EEP", "ActiveMQ.Advisory.Producer.Topic", > and "ActiveMQ.Advisory.NetworkBridge". However, it seems these topics only > reflect the status of local ActiveMQ subscribers. I have also looked at > ActiveMQ documentation for any other advisory topic that can be enabled to > get notification of remote broker client/subscriber > connection/disconnection. But so far I have not been able to find anything. > > Any help/guidance with above situation is most appreciated. > > Regards > Nauman > > > > > -- > View this message in context: > http://activemq.2283324.n4.nabble.com/Advisory-messages-for-remote-broker-clients-tp4683016.html > Sent from the ActiveMQ - Dev mailing list archive at Nabble.com. > -- *Christian Posta* http://www.christianposta.com/blog http://fabric8.io twitter: @christianposta
