开发者

activemq transportlistener how to use

开发者 https://www.devze.com 2022-12-29 19:39 出处:网络
I am using two brokers and create a consumer connection like this ccf = new ActiveMQConnectionFactory(new URI(\"failover://(tcp://0.0.0.0:61617,tcp://0.0.0.0:61618)\"));

I am using two brokers and create a consumer connection like this

 ccf = new ActiveMQConnectionFactory(new URI("failover://(tcp://0.0.0.0:61617,tcp://0.0.0.0:61618)"));
 ccf.setTransportListener(this);

I see in the logs that if one broker goes down the conn开发者_StackOverflow中文版ection reconnects to other failover But how & where do i catch this event


Ok transportlistener needs to be set on the ActiveMQConnection

 cc = ccf.createConnection();
 cc.start();
 ActiveMQConnection acc = (ActiveMQConnection) cc;
 acc.addTransportListener(this);

Now the transportresumed and other callbacks occur.


The transportInterrupted/Resumed is not called when the Ethernet cable is unplugged. It is called when a graceful shutdown is done to the broker..

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号