actviemq 使用过程中碰到的问题

activemq 使用中碰到的两个问题:

#1.重启activemq,没有重启生产者消费者应用,导致消息法务发生和接收。

搜索结果建议把联系的串改成:failover:(tcp://127.0.0.1:61616) 。使用断线重连机制。具体就是使用failover方式,使得连接断开之后,可以不断的重试连接到一个或多个brokerURL。

#2.重启了生产者,但是时间比较久,发现消费者无法消费消息。

看到log:

| INFO  | Transport failed: org.apache.activemq.transport.InactivityIOException: Channel was inactive for too (>30000) long: /192.XX.X.XX:60286 | org.apache.activemq.broker.TransportConnection.Transport | InactivityMonitor Async Task: java.util.concurrent.ThreadPoolExecutor$Worker@4384111f[State = -1, empty queue]

官方说法:

The ActiveMQ InactivityMonitor is an active thread that checks the connection is still active and if it suspects the connection is not functioning correctly, it closes the connection.

Each connection has two InactivityMonitors associated, one on each end of the connection. The InactivityMonitor expects to receive data on the connection during a specified time period. If normal activemq traffic has not been sent across the connection during that period, it expects to receive a KeepAliveInfo message sent by the InactivityMonitor on the other end of the connection.


应该是activemq,每一个连接会有2个InactivityMonitor监控,如果没有收到正常的数据,另一个会发送KeepAliveInfo信息来确保连接正常 ,如果指定时间都没有收到,会自动关闭连接

http://activemq.apache.org/activemq-inactivitymonitor.html

猜你喜欢

转载自iamh.iteye.com/blog/2322480