【问题标题】:ActiveMQ - handle connection, session, producer and concumer opon failoverActiveMQ - 在故障转移时处理连接、会话、生产者和消费者
【发布时间】:2015-08-17 11:09:52
【问题描述】:

我确实通过在代理 URL 中使用以下模式来使用故障转移传输功能

failover:(tcp://host:port)

初始化代码如下:

factory = new PooledConnectionFactory(BROKER_URL);
connection = factory.createConnection();
connection.start(); 

put 消息代码大致如下:

session = connection.createSession( false, Session.AUTO_ACKNOWLEDGE );
Destination destQueue = new ActiveMQQueue(queue);
MessageProducer producer = session.createProducer(destQueue);
TextMessage msg = session.createTextMessage(message);
producer.send(msg);

发生故障转移时 -

[org.apache.activemq.transport.failover.FailoverTransport] Transport (broker) failed, reason:  , attempting to automatically reconnect: java.net.SocketException: recv failed: Connection aborted by peer

and got reconnected after
[org.apache.activemq.transport.failover.FailoverTransport] Failed to connect to [broker] after: 10 attempt(s) continuing to retry.
08:55:29,596 INFO  [org.apache.activemq.transport.failover.FailoverTransport] Successfully reconnected to broker

我必须重新启动连接吗?或者更具体地说,我是否必须对连接对象执行任何操作才能在故障转移后生成/使用消息?

谢谢

【问题讨论】:

    标签: jms activemq failover


    【解决方案1】:

    故障转移传输的重点是为您处理重新连接。您显示的日志表明成功的重新连接周期,其中传输继续重试连接到代理并最终这样做。

    【讨论】:

      猜你喜欢
      • 2016-05-19
      • 2017-04-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-14
      • 2015-07-23
      • 1970-01-01
      相关资源
      最近更新 更多