问题描述
我们的客户端连接到具有2个ActiveMQ节点的群集。当我们手动断开客户端和群集之间的网络连接时,Apache.NMS.ActiveMQ库将挂起。
我们使用Apache.NMS.ActiveMQ版本1.7.2和基于ActiveMQ 5.15.3的集群。
连接URI为:
故障转移:(tcp:// dd-amq-app01:61616,tcp:// dd-amq-app02:61616)?transport.maxReconnectAttempts = 0& transport.startupMaxReconnectAttempts = 0& transport.useExponentialBackOff = false& transport.maxReconnectDelay = 1000& transport.timeout = 10000
我希望库在无法连接或重新连接时会抛出异常,但是它永远挂着。
跟踪日志:
INFO 2018-08-23 15:29:19,995 [135] DC.ActiveMQ.ActiveMqLogger BrokerUri set = failover:(tcp:// dd-amq -app01:61616,tcp:// dd-amq-app02:61616)?transport.maxReconnectAttempts = 0& transport.startupMaxReconnectAttempts = 0& transport.useExponentialBackOff = false& transport.maxReconnectDelay = 1000& transport.timeout = 10000
DEBUG 2018-08-23 15:29:19,995 [135] DC.ActiveMQ.ActiveMqLogger SetPr使用target:ConnectionFactory和prefix:connection调用的操作。
DEBUG 2018-08-23 15:29:19,995 [135]调用DC.ActiveMQ.ActiveMqLogger SetProperties,目标为:ConnectionFactory,前缀为nms。
INFO 2018-08-23 15:29:19,995 [46] DC.ActiveMQ.ActiveMqLogger连接到:故障转移:(tcp:// dd-amq-app01:61616,tcp:// dd-amq-app02 :61616)?transport.maxreconnectdelay = 1000& transport.timeout = 10000& transport.maxreconnectattempts = 0& transport.startupmaxreconnectattempts = 0& transport.useexponentialbackoff = false
INFO 2018-08-23 15:29:19,995 [135 DC.ActiveMQ.ActiveMqLogger连接到:故障转移:(tcp:// dd-amq-app01:61616,tcp:// dd-amq-app02:61616)?transport.maxreconnectdelay = 1000& transport.timeout = 10000& transport .maxreconnectattempts = 0& transport.startupmaxreconnectattempts = 0& transport.useexponentialbackoff = false
DEBUG 2018-08-23 15:29:20,011 [4] DC.ActiveMQ.ActiveMqLogger Consumer [ID:vm-dc-test2-49838 -636706331613744874-1:1165:1:1]发送对MessageId的个人确认:ID:vm-dc-test2-49838-636706331613744874-1:1246:1:1:1:184415
DEBUG 2018-08-23 15:29:20,011 [4] DC.ActiveMQ.ActiveMqLogger会话发送Ack:MessageAck [commandId = 0,responseRequired = False,目标=队列:// EdiInbound,TransactionId =,ConsumerId = ID:vm-dc-test2-49838-636706331613744874-1:1165:1:1,AckType = 4,FirstMessageId =,LastMessageId = ID :vm-dc-test2-49838-636706331613744874-1:1246:1:1:1:184415,MessageCount = 1,PoisonCause =]
DEBUG 2018-08-23 15:29:20,011 [2] DC。 ActiveMQ.ActiveMqLogger InactivityMonitor [1172]:已停止的监视线程。
DEBUG 2018-08-23 15:29:20,011 [2] DC.ActiveMQ.ActiveMqLogger InactivityMonitor [1172]:已停止的监视线程。
DEBUG 2018-08-23 15:29:20,011 [2] DC.ActiveMQ.ActiveMqLogger InactivityMonitor [1170]:已停止的监视线程。
DEBUG 2018-08-23 15:29:20,011 [2] DC.ActiveMQ.ActiveMqLogger InactivityMonitor [1170]:已停止的监视线程。
DEBUG 2018-08-23 15:29:20,011 [135]触发了DC.ActiveMQ.ActiveMqLogger重新连接,但尚未开始传输。等待开始连接传输。
DEBUG 2018-08-23 15:29:20,011 [135] DC.ActiveMQ.ActiveMqLogger FailoverTransport已启动。
DEBUG 2018-08-23 15:29:20,011 [135] DC.ActiveMQ.ActiveMqLogger FailoverTransport未连接,开始重新连接。
DEBUG 2018-08-23 15:29:20,011 [135] DC.ActiveMQ.ActiveMqLogger唤醒重新连接任务
DEBUG 2018-08-23 15:29:20,011 [135] DC.ActiveMQ.ActiveMqLogger等待传输重新连接。
DEBUG 2018-08-23 15:29:20,011 [ActiveMQ故障转移工人:22429852] DC.ActiveMQ.ActiveMqLogger Uri连接列表:tcp:// dd-amq-app02:61616 /,tcp:// dd- amq-app01:61616 / from:tcp:// dd-amq-app01:61616 /,tcp:// dd-amq-app02:61616 /
DEBUG 2018-08-23 15:29:20,011 [2 ] DC.ActiveMQ.ActiveMqLogger InactivityMonitor [1171]:已停止的监视器线程。
DEBUG 2018-08-23 15:29:20,011 [2] DC.ActiveMQ.ActiveMqLogger InactivityMonitor [1171]:已停止的监视线程。
DEBUG 2018-08-23 15:29:20,011 [ActiveMQ故障转移工作者:22429852] DC.ActiveMQ.ActiveMqLogger尝试0次连接:
DEBUG 2018-08-23 15:29:20,011 [ActiveMQ故障转移工作者:22429852] DC.ActiveMQ.ActiveMqLogger打开套接字:端口dd-amq-app02:61616
DEBUG 2018-08-23 15:29:20,011 [46]触发了DC.ActiveMQ.ActiveMqLogger重新连接,但传输了尚未开始。等待开始连接传输。
DEBUG 2018-08-23 15:29:20,011 [46] DC.ActiveMQ.ActiveMqLogger FailoverTransport已启动。
DEBUG 2018-08-23 15:29:20,011 [46] DC.ActiveMQ.ActiveMqLogger FailoverTransport未连接,开始重新连接。
DEBUG 2018-08-23 15:29:20,011 [46] DC.ActiveMQ.ActiveMqLogger唤醒重新连接任务
DEBUG 2018-08-23 15:29:20,011 [46] DC.ActiveMQ.ActiveMqLogger等待传输重新连接。
DEBUG 2018-08-23 15:29:20,011 [ActiveMQ故障转移工人:22429852] DC.ActiveMQ.ActiveMqLogger使用InterNetwork协议连接到dd-amq-app02:61616。
DEBUG 2018-08-23 15:29:20,026 [ActiveMQ故障转移工人:22429852] DC.ActiveMQ.ActiveMqLogger创建不活动监视器:1173
DEBUG 2018-08-23 15:29:20,011 [ActiveMQ故障转移工作者:18711279] DC.ActiveMQ.ActiveMqLogger Uri连接列表:tcp:// dd-amq-app02:61616 /,tcp:// dd-amq-app01:61616 / from:tcp:// dd-amq-app01: 61616 /,tcp:// dd-amq-app02:61616 /
DEBUG 2018-08-23 15:29:20,026 [ActiveMQ故障转移工作者:18711279] DC.ActiveMQ.ActiveMqLogger尝试0次连接到:
DEBUG 2018-08-23 15:29:20,026 [ActiveMQ故障转移工作者:18711279] DC.ActiveMQ.ActiveMqLogger打开套接字到:dd-amq-app02端口:61616
DEBUG 2018-08-23 15:29 :20,026 [ActiveMQ故障转移工人:22429852] DC.ActiveMQ.ActiveMqLogger连接已建立
DEBUG 2018-08-23 15:29:20,026 [ActiveMQ故障转移工人:22429852] DC.ActiveMQ.ActiveMqLogger连接[ID:vm-dc -test2-49838-636706331613744874-1:1247]:传输已恢复正常运行。
INFO 2018-08-23 15:29:20,026 [ActiveMQ故障转移工人:22429852] DC.ActiveMQ.ActiveMqLogger成功连接到tcp:// dd-amq-app02:61616 /
2018年8月调试-23 15:29:21,683 [9] DC.ActiveMQ.ActiveMqLogger InactivityMonitor [1094]:自上次写检查以来发送的消息。重置标志。
DEBUG 2018-08-23 15:29:21,683 [9] DC.ActiveMQ.ActiveMqLogger InactivityMonitor [1094]:当前不允许进行读取检查。
DEBUG 2018-08-23 15:29:30,012 [4] DC.ActiveMQ.ActiveMqLogger使用者[ID:vm-dc-test2-49838-636706331613744874-1:1165:1:1]无活动TX或未决袜子,正常关闭。
DEBUG 2018-08-23 15:29:30,012 [4]消费者[ID:vm-dc-test2-49838-636706331613744874-1:1165:1:1]的DC.ActiveMQ.ActiveMqLogger关闭已开始。
DEBUG 2018-08-23 15:29:30,012 [4]完成Consumer [ID:vm-dc-test2-49838-636706331613744874-1:1165:1:1]的DC.ActiveMQ.ActiveMqLogger关闭。
DEBUG 2018-08-23 15:29:30,012 [4] DC.ActiveMQ.ActiveMqLogger删除目标[的使用者[ID:vm-dc-test2-49838-636706331613744874-1:1165:1:1] queue:// EdiInbound]发送了最后一个传递的ID [184415]。
INFO 2018-08-23 15:29:30,012 [4] DC.ActiveMQ.ActiveMqLogger关闭ID为ID的会话:vm-dc-test2-49838-636706331613744874-1:1165:1
INFO 2018-08-23 15:29:30,012 [4] DC.ActiveMQ.ActiveMqLogger对ID为ID的会话执行关机:vm-dc-test2-49838-636706331613744744-1:1165:1
INFO 2018-08- 23 15:29:30,012 [4] DC.ActiveMQ.ActiveMqLogger关闭了具有ID ID的会话:vm-dc-test2-49838-636706331613744874-1:1165:1
INFO 2018-08-23 15:29: 30,012 [4] DC.ActiveMQ.ActiveMqLogger连接[ID:vm-dc-test2-49838-636706331613744874-1:1165]:立即关闭连接。
DEBUG 2018-08-23 15:29:30,012 [4] DC.ActiveMQ.ActiveMqLogger Connection [ID:vm-dc-test2-49838-636706331613744874-1:1165]:同步处理连接。
DEBUG 2018-08-23 15:29:31,699 [79] DC.ActiveMQ.ActiveMqLogger InactivityMonitor [1094]:自上次写检查以来发送的消息。重置标志。
DEBUG 2018-08-23 15:29:31,699 [79] DC.ActiveMQ.ActiveMqLogger InactivityMonitor [1094]:当前不允许进行读取检查。在c:\dev\NMS.ActiveMQ\src\main\csharp\Transport\FutureResponse.cs:line 57 $中的Apache.NMS.ActiveMQ.Transport.FutureResponse.get_Response()中的
b $ b DEBUG 2018-08-23 15:29:35,027 [4] DC.ActiveMQ.ActiveMqLogger Connection [ID:vm-dc-test2-49838-636706331613744874-1:1165]:处理传输。
DEBUG 2018-08-23 15:29:35,027 [4] DC.ActiveMQ.ActiveMqLogger FailoverTransport已停止。
DEBUG 2018-08-23 15:29:35,027 [4] DC.ActiveMQ.ActiveMqLogger InactivityMonitor [1094] .Runner:任务运行器关闭了
DEBUG 2018-08-23 15:29:35,027 [ 4] DC.ActiveMQ.ActiveMqLogger InactivityMonitor [1094]:已停止的监视线程。
DEBUG 2018-08-23 15:29:35,027 [135] DC.ActiveMQ.ActiveMqLogger发送单向尝试:0失败:消息=有线格式协商超时:对等方未发送其有线格式。
DEBUG 2018-08-23 15:29:35,027 [135] DC.ActiveMQ.ActiveMqLogger失败消息为:ConnectionInfo [commandId = 1,responseRequired = True,ConnectionId = ID:vm-dc-test2-49838-636706331613744874 -1:1247,ClientId = 208221b7-139f-464b-ad6f-2fa99243faea,密码= systemPassword,用户名= system,BrokerPath =,BrokerMasterConnector = False,Manageable = False,ClientMaster = False,FaultTolerant =真,FailoverReconnect = False,ClientIp = ]
DEBUG 2018-08-23 15:29:35,027 [135] DC.ActiveMQ.ActiveMqLogger InactivityMonitor [1173]:已停止的监视线程。
DEBUG 2018-08-23 15:29:35,027 [15] DC.ActiveMQ.ActiveMqLogger TransportFilter处理下一个传输的方法:MutexTransport
DEBUG 2018-08-23 15:29:35,027 [15] DC。 ActiveMQ.ActiveMqLogger TransportFilter处理下一个传输:FailoverTransport
DEBUG 2018-08-23 15:29:35,027 [15] DC.ActiveMQ.ActiveMqLogger FailoverTransport已停止。
DEBUG 2018-08-23 15:29:35,027 [4] DC.ActiveMQ.ActiveMqLogger TransportFilter处理下一次传输的方法:MutexTransport
DEBUG 2018-08-23 15:29:35,027 [4] DC。 ActiveMQ.ActiveMqLogger TransportFilter处理下一个传输:FailoverTransport
DEBUG 2018-08-23 15:29:35,027 [4] DC.ActiveMQ.ActiveMqLogger FailoverTransport已停止。
DEBUG 2018-08-23 15:29:35,043 [135] DC.ActiveMQ.ActiveMqLogger FailoverTransport已启动。
DEBUG 2018-08-23 15:29:35,043 [135] DC.ActiveMQ.ActiveMqLogger FailoverTransport未连接,开始重新连接。
DEBUG 2018-08-23 15:29:35,043 [135] DC.ActiveMQ.ActiveMqLogger唤醒重新连接任务
DEBUG 2018-08-23 15:29:35,574 [2] DC.ActiveMQ.ActiveMqLogger InactivityMonitor [1173]:已停止的监视器线程。
DEBUG 2018-08-23 15:29:35,574 [2] DC.ActiveMQ.ActiveMqLogger InactivityMonitor [1173]:已停止的监视线程。
DEBUG 2018-08-23 15:29:38,059 [ActiveMQ故障转移工作者:63267701] DC.ActiveMQ.ActiveMqLogger Connect失败:tcp:// dd-amq-app01:61616 /,原因:连接到dd时出错-amq-app01:61616。
DEBUG 2018-08-23 15:29:38,059 [ActiveMQ故障转移工人:63267701]尝试0号的DC.ActiveMQ.ActiveMqLogger连接到:tcp:// dd-amq-app01:61616 /
2018年12月-08-23 15:29:38,059 [ActiveMQ故障转移工人:63267701] DC.ActiveMQ.ActiveMqLogger打开端口:dd-amq-app02,端口:61616
DEBUG 2018-08-23 15:29:41,043 [ ActiveMQ故障转移工作者:18711279] DC.ActiveMQ.ActiveMqLogger Connect失败:tcp:// dd-amq-app02:61616 /,原因:连接到dd-amq-app02:61616时出错。
DEBUG 2018-08-23 15:29:41,043 [ActiveMQ故障转移工人:18711279]尝试0号的DC.ActiveMQ.ActiveMqLogger连接到:tcp:// dd-amq-app02:61616 /
2018年12月-08-23 15:29:41,043 [ActiveMQ故障转移工作者:18711279] DC.ActiveMQ.ActiveMqLogger打开套接字:dd-amq-app01,端口:61616
DEBUG 2018-08-23 15:29:59,059 [ ActiveMQ故障转移工作者:63267701] DC.ActiveMQ.ActiveMqLogger Connect失败:tcp:// dd-amq-app02:61616 /,原因:连接到dd-amq-app02:61616时出错。
错误2018-08-23 15:29:59,059 [ActiveMQ故障转移工人:63267701] DC.ActiveMQ.ActiveMqLogger无法连接到tcp:// dd-amq-app01:61616 /,tcp:// dd- amq-app02:61616 /之后:1次尝试
DEBUG 2018-08-23 15:29:59,059 [52] DC.ActiveMQ.ActiveMqLogger TransportFilter处置下一个运输:MutexTransport
DEBUG 2018- 08-23 15:29:59,059 [52] DC.ActiveMQ.ActiveMqLogger TransportFilter处理下一个传输:FailoverTransport
DEBUG 2018-08-23 15:29:59,059 [52] DC.ActiveMQ.ActiveMqLogger FailoverTransport已停止。
我该如何防止饥饿?可能是URI中的其他连接参数吗?
让Uri中断
故障转移:(tcp:// dd-amq-app01:61616,tcp:// dd-amq-app02:61616)?transport.maxReconnectAttempts = 0& transport.startupMaxReconnectAttempts = 0& ; transport.useExponentialBackOff = false& transport.maxReconnectDelay = 1000& transport.timeout = 10000
-
故障转移:(tcp:// dd-amq-app01:61616,tcp:// dd-amq-app02:61616)
提示有两个uri作为主要& secondary
它将在尝试连接时继续从Primary迁移到Primary to Primary ...
-
transport.maxReconnectAttempts = 0
说永远尝试
您可以将uri作为
failover:(tcp:// dd- amq-app01:61616,tcp:// dd-amq-app02:61616)?transport.timeout = 10000& maxReconnectAttempts = 1
并尝试捕获异常
在尝试超时后,它将抛出Timeout异常。
请参考
Our client connects to cluster with 2 ActiveMQ nodes. Apache.NMS.ActiveMQ library hang when we drop network connection manually between client and cluster.We use Apache.NMS.ActiveMQ with version 1.7.2 and cluster based on ActiveMQ 5.15.3.
Connection URI is:
failover:(tcp://dd-amq-app01:61616,tcp://dd-amq-app02:61616)?transport.maxReconnectAttempts=0&transport.startupMaxReconnectAttempts=0&transport.useExponentialBackOff=false&transport.maxReconnectDelay=1000&transport.timeout=10000
I expect that library should throw exception when it cann't connect or reconnect, but it hang on forever.
Tracer logs:
INFO 2018-08-23 15:29:19,995 [135] DC.ActiveMQ.ActiveMqLogger BrokerUri set = failover:(tcp://dd-amq-app01:61616,tcp://dd-amq-app02:61616)?transport.maxReconnectAttempts=0&transport.startupMaxReconnectAttempts=0&transport.useExponentialBackOff=false&transport.maxReconnectDelay=1000&transport.timeout=10000
DEBUG 2018-08-23 15:29:19,995 [135] DC.ActiveMQ.ActiveMqLogger SetProperties called with target: ConnectionFactory, and prefix: connection.
DEBUG 2018-08-23 15:29:19,995 [135] DC.ActiveMQ.ActiveMqLogger SetProperties called with target: ConnectionFactory, and prefix: nms.
INFO 2018-08-23 15:29:19,995 [46] DC.ActiveMQ.ActiveMqLogger Connecting to: failover:(tcp://dd-amq-app01:61616,tcp://dd-amq-app02:61616)?transport.maxreconnectdelay=1000&transport.timeout=10000&transport.maxreconnectattempts=0&transport.startupmaxreconnectattempts=0&transport.useexponentialbackoff=false
INFO 2018-08-23 15:29:19,995 [135] DC.ActiveMQ.ActiveMqLogger Connecting to: failover:(tcp://dd-amq-app01:61616,tcp://dd-amq-app02:61616)?transport.maxreconnectdelay=1000&transport.timeout=10000&transport.maxreconnectattempts=0&transport.startupmaxreconnectattempts=0&transport.useexponentialbackoff=false
DEBUG 2018-08-23 15:29:20,011 [4] DC.ActiveMQ.ActiveMqLogger Consumer[ID:vm-dc-test2-49838-636706331613744874-1:1165:1:1] sending Individual Ack for MessageId: ID:vm-dc-test2-49838-636706331613744874-1:1246:1:1:1:184415
DEBUG 2018-08-23 15:29:20,011 [4] DC.ActiveMQ.ActiveMqLogger Session sending Ack: MessageAck[ commandId = 0, responseRequired = False, Destination = queue://EdiInbound, TransactionId = , ConsumerId = ID:vm-dc-test2-49838-636706331613744874-1:1165:1:1, AckType = 4, FirstMessageId = , LastMessageId = ID:vm-dc-test2-49838-636706331613744874-1:1246:1:1:1:184415, MessageCount = 1, PoisonCause = ]
DEBUG 2018-08-23 15:29:20,011 [2] DC.ActiveMQ.ActiveMqLogger InactivityMonitor[1172]: Stopped Monitor Threads.
DEBUG 2018-08-23 15:29:20,011 [2] DC.ActiveMQ.ActiveMqLogger InactivityMonitor[1172]: Stopped Monitor Threads.
DEBUG 2018-08-23 15:29:20,011 [2] DC.ActiveMQ.ActiveMqLogger InactivityMonitor[1170]: Stopped Monitor Threads.
DEBUG 2018-08-23 15:29:20,011 [2] DC.ActiveMQ.ActiveMqLogger InactivityMonitor[1170]: Stopped Monitor Threads.
DEBUG 2018-08-23 15:29:20,011 [135] DC.ActiveMQ.ActiveMqLogger Reconnect was triggered but transport is not started yet. Wait for start to connect the transport.
DEBUG 2018-08-23 15:29:20,011 [135] DC.ActiveMQ.ActiveMqLogger FailoverTransport Started.
DEBUG 2018-08-23 15:29:20,011 [135] DC.ActiveMQ.ActiveMqLogger FailoverTransport not connected, start is reconnecting.
DEBUG 2018-08-23 15:29:20,011 [135] DC.ActiveMQ.ActiveMqLogger Waking up reconnect task
DEBUG 2018-08-23 15:29:20,011 [135] DC.ActiveMQ.ActiveMqLogger Waiting for transport to reconnect.
DEBUG 2018-08-23 15:29:20,011 [ActiveMQ Failover Worker: 22429852] DC.ActiveMQ.ActiveMqLogger Uri connection list: tcp://dd-amq-app02:61616/,tcp://dd-amq-app01:61616/ from: tcp://dd-amq-app01:61616/,tcp://dd-amq-app02:61616/
DEBUG 2018-08-23 15:29:20,011 [2] DC.ActiveMQ.ActiveMqLogger InactivityMonitor[1171]: Stopped Monitor Threads.
DEBUG 2018-08-23 15:29:20,011 [2] DC.ActiveMQ.ActiveMqLogger InactivityMonitor[1171]: Stopped Monitor Threads.
DEBUG 2018-08-23 15:29:20,011 [ActiveMQ Failover Worker: 22429852] DC.ActiveMQ.ActiveMqLogger Attempting 0th connect to:
DEBUG 2018-08-23 15:29:20,011 [ActiveMQ Failover Worker: 22429852] DC.ActiveMQ.ActiveMqLogger Opening socket to: dd-amq-app02 on port: 61616
DEBUG 2018-08-23 15:29:20,011 [46] DC.ActiveMQ.ActiveMqLogger Reconnect was triggered but transport is not started yet. Wait for start to connect the transport.
DEBUG 2018-08-23 15:29:20,011 [46] DC.ActiveMQ.ActiveMqLogger FailoverTransport Started.
DEBUG 2018-08-23 15:29:20,011 [46] DC.ActiveMQ.ActiveMqLogger FailoverTransport not connected, start is reconnecting.
DEBUG 2018-08-23 15:29:20,011 [46] DC.ActiveMQ.ActiveMqLogger Waking up reconnect task
DEBUG 2018-08-23 15:29:20,011 [46] DC.ActiveMQ.ActiveMqLogger Waiting for transport to reconnect.
DEBUG 2018-08-23 15:29:20,011 [ActiveMQ Failover Worker: 22429852] DC.ActiveMQ.ActiveMqLogger Connected to dd-amq-app02:61616 using InterNetwork protocol.
DEBUG 2018-08-23 15:29:20,026 [ActiveMQ Failover Worker: 22429852] DC.ActiveMQ.ActiveMqLogger Creating Inactivity Monitor: 1173
DEBUG 2018-08-23 15:29:20,011 [ActiveMQ Failover Worker: 18711279] DC.ActiveMQ.ActiveMqLogger Uri connection list: tcp://dd-amq-app02:61616/,tcp://dd-amq-app01:61616/ from: tcp://dd-amq-app01:61616/,tcp://dd-amq-app02:61616/
DEBUG 2018-08-23 15:29:20,026 [ActiveMQ Failover Worker: 18711279] DC.ActiveMQ.ActiveMqLogger Attempting 0th connect to:
DEBUG 2018-08-23 15:29:20,026 [ActiveMQ Failover Worker: 18711279] DC.ActiveMQ.ActiveMqLogger Opening socket to: dd-amq-app02 on port: 61616
DEBUG 2018-08-23 15:29:20,026 [ActiveMQ Failover Worker: 22429852] DC.ActiveMQ.ActiveMqLogger Connection established
DEBUG 2018-08-23 15:29:20,026 [ActiveMQ Failover Worker: 22429852] DC.ActiveMQ.ActiveMqLogger Connection[ID:vm-dc-test2-49838-636706331613744874-1:1247]: Transport has resumed normal operation.
INFO 2018-08-23 15:29:20,026 [ActiveMQ Failover Worker: 22429852] DC.ActiveMQ.ActiveMqLogger Successfully connected to tcp://dd-amq-app02:61616/
DEBUG 2018-08-23 15:29:21,683 [9] DC.ActiveMQ.ActiveMqLogger InactivityMonitor[1094]: Message sent since last write check. Resetting flag.
DEBUG 2018-08-23 15:29:21,683 [9] DC.ActiveMQ.ActiveMqLogger InactivityMonitor[1094]: A read check is not currently allowed.
DEBUG 2018-08-23 15:29:30,012 [4] DC.ActiveMQ.ActiveMqLogger Consumer[ID:vm-dc-test2-49838-636706331613744874-1:1165:1:1] No Active TX or pending acks, closing normally.
DEBUG 2018-08-23 15:29:30,012 [4] DC.ActiveMQ.ActiveMqLogger Shutdown of Consumer[ID:vm-dc-test2-49838-636706331613744874-1:1165:1:1] started.
DEBUG 2018-08-23 15:29:30,012 [4] DC.ActiveMQ.ActiveMqLogger Shutdown of Consumer[ID:vm-dc-test2-49838-636706331613744874-1:1165:1:1] completed.
DEBUG 2018-08-23 15:29:30,012 [4] DC.ActiveMQ.ActiveMqLogger Remove of Consumer[ID:vm-dc-test2-49838-636706331613744874-1:1165:1:1] of destination [queue://EdiInbound] sent last delivered Id[184415].
INFO 2018-08-23 15:29:30,012 [4] DC.ActiveMQ.ActiveMqLogger Closing The Session with Id ID:vm-dc-test2-49838-636706331613744874-1:1165:1
INFO 2018-08-23 15:29:30,012 [4] DC.ActiveMQ.ActiveMqLogger Executing Shutdown on Session with Id ID:vm-dc-test2-49838-636706331613744874-1:1165:1
INFO 2018-08-23 15:29:30,012 [4] DC.ActiveMQ.ActiveMqLogger Closed The Session with Id ID:vm-dc-test2-49838-636706331613744874-1:1165:1
INFO 2018-08-23 15:29:30,012 [4] DC.ActiveMQ.ActiveMqLogger Connection[ID:vm-dc-test2-49838-636706331613744874-1:1165]: Closing Connection Now.
DEBUG 2018-08-23 15:29:30,012 [4] DC.ActiveMQ.ActiveMqLogger Connection[ID:vm-dc-test2-49838-636706331613744874-1:1165]: Synchronously disposing of Connection.
DEBUG 2018-08-23 15:29:31,699 [79] DC.ActiveMQ.ActiveMqLogger InactivityMonitor[1094]: Message sent since last write check. Resetting flag.
DEBUG 2018-08-23 15:29:31,699 [79] DC.ActiveMQ.ActiveMqLogger InactivityMonitor[1094]: A read check is not currently allowed.
at Apache.NMS.ActiveMQ.Transport.FutureResponse.get_Response() in c:\dev\NMS.ActiveMQ\src\main\csharp\Transport\FutureResponse.cs:line 57
DEBUG 2018-08-23 15:29:35,027 [4] DC.ActiveMQ.ActiveMqLogger Connection[ID:vm-dc-test2-49838-636706331613744874-1:1165]: Disposing of the Transport.
DEBUG 2018-08-23 15:29:35,027 [4] DC.ActiveMQ.ActiveMqLogger FailoverTransport Stopped.
DEBUG 2018-08-23 15:29:35,027 [4] DC.ActiveMQ.ActiveMqLogger InactivityMonitor[1094].Runner: Task Runner Shut Down
DEBUG 2018-08-23 15:29:35,027 [4] DC.ActiveMQ.ActiveMqLogger InactivityMonitor[1094]: Stopped Monitor Threads.
DEBUG 2018-08-23 15:29:35,027 [135] DC.ActiveMQ.ActiveMqLogger Send Oneway attempt: 0 failed: Message = Wire format negotiation timeout: peer did not send his wire format.
DEBUG 2018-08-23 15:29:35,027 [135] DC.ActiveMQ.ActiveMqLogger Failed Message Was: ConnectionInfo[ commandId = 1, responseRequired = True, ConnectionId = ID:vm-dc-test2-49838-636706331613744874-1:1247, ClientId = 208221b7-139f-464b-ad6f-2fa99243faea, Password = systemPassword, UserName = system, BrokerPath = , BrokerMasterConnector = False, Manageable = False, ClientMaster = False, FaultTolerant = True, FailoverReconnect = False, ClientIp = ]
DEBUG 2018-08-23 15:29:35,027 [135] DC.ActiveMQ.ActiveMqLogger InactivityMonitor[1173]: Stopped Monitor Threads.
DEBUG 2018-08-23 15:29:35,027 [15] DC.ActiveMQ.ActiveMqLogger TransportFilter disposing of next Transport: MutexTransport
DEBUG 2018-08-23 15:29:35,027 [15] DC.ActiveMQ.ActiveMqLogger TransportFilter disposing of next Transport: FailoverTransport
DEBUG 2018-08-23 15:29:35,027 [15] DC.ActiveMQ.ActiveMqLogger FailoverTransport Stopped.
DEBUG 2018-08-23 15:29:35,027 [4] DC.ActiveMQ.ActiveMqLogger TransportFilter disposing of next Transport: MutexTransport
DEBUG 2018-08-23 15:29:35,027 [4] DC.ActiveMQ.ActiveMqLogger TransportFilter disposing of next Transport: FailoverTransport
DEBUG 2018-08-23 15:29:35,027 [4] DC.ActiveMQ.ActiveMqLogger FailoverTransport Already Stopped.
DEBUG 2018-08-23 15:29:35,043 [135] DC.ActiveMQ.ActiveMqLogger FailoverTransport Started.
DEBUG 2018-08-23 15:29:35,043 [135] DC.ActiveMQ.ActiveMqLogger FailoverTransport not connected, start is reconnecting.
DEBUG 2018-08-23 15:29:35,043 [135] DC.ActiveMQ.ActiveMqLogger Waking up reconnect task
DEBUG 2018-08-23 15:29:35,574 [2] DC.ActiveMQ.ActiveMqLogger InactivityMonitor[1173]: Stopped Monitor Threads.
DEBUG 2018-08-23 15:29:35,574 [2] DC.ActiveMQ.ActiveMqLogger InactivityMonitor[1173]: Stopped Monitor Threads.
DEBUG 2018-08-23 15:29:38,059 [ActiveMQ Failover Worker: 63267701] DC.ActiveMQ.ActiveMqLogger Connect fail to: tcp://dd-amq-app01:61616/, reason: Error connecting to dd-amq-app01:61616.
DEBUG 2018-08-23 15:29:38,059 [ActiveMQ Failover Worker: 63267701] DC.ActiveMQ.ActiveMqLogger Attempting 0th connect to: tcp://dd-amq-app01:61616/
DEBUG 2018-08-23 15:29:38,059 [ActiveMQ Failover Worker: 63267701] DC.ActiveMQ.ActiveMqLogger Opening socket to: dd-amq-app02 on port: 61616
DEBUG 2018-08-23 15:29:41,043 [ActiveMQ Failover Worker: 18711279] DC.ActiveMQ.ActiveMqLogger Connect fail to: tcp://dd-amq-app02:61616/, reason: Error connecting to dd-amq-app02:61616.
DEBUG 2018-08-23 15:29:41,043 [ActiveMQ Failover Worker: 18711279] DC.ActiveMQ.ActiveMqLogger Attempting 0th connect to: tcp://dd-amq-app02:61616/
DEBUG 2018-08-23 15:29:41,043 [ActiveMQ Failover Worker: 18711279] DC.ActiveMQ.ActiveMqLogger Opening socket to: dd-amq-app01 on port: 61616
DEBUG 2018-08-23 15:29:59,059 [ActiveMQ Failover Worker: 63267701] DC.ActiveMQ.ActiveMqLogger Connect fail to: tcp://dd-amq-app02:61616/, reason: Error connecting to dd-amq-app02:61616.
ERROR 2018-08-23 15:29:59,059 [ActiveMQ Failover Worker: 63267701] DC.ActiveMQ.ActiveMqLogger Failed to connect to tcp://dd-amq-app01:61616/,tcp://dd-amq-app02:61616/ after: 1 attempt(s)
DEBUG 2018-08-23 15:29:59,059 [52] DC.ActiveMQ.ActiveMqLogger TransportFilter disposing of next Transport: MutexTransport
DEBUG 2018-08-23 15:29:59,059 [52] DC.ActiveMQ.ActiveMqLogger TransportFilter disposing of next Transport: FailoverTransport
DEBUG 2018-08-23 15:29:59,059 [52] DC.ActiveMQ.ActiveMqLogger FailoverTransport Stopped.
What can I do to prevent hungs? May be other connection parameters in URI?
Lets break the Uri
failover:(tcp://dd-amq-app01:61616,tcp://dd-amq-app02:61616)?transport.maxReconnectAttempts=0&transport.startupMaxReconnectAttempts=0&transport.useExponentialBackOff=false&transport.maxReconnectDelay=1000&transport.timeout=10000
- The
failover:(tcp://dd-amq-app01:61616,tcp://dd-amq-app02:61616)
suggest there are two uri as primary & secondary
It will keep on moving as Primary to secondary to Primary... as it is trying to connect
transport.maxReconnectAttempts=0
says to try forever
You can have the uri as
failover:(tcp://dd-amq-app01:61616,tcp://dd-amq-app02:61616)?transport.timeout=10000&maxReconnectAttempts=1
And try to catch the Exception
It will throw the Timeout exception after trying once the Timeout expired.
Please refer to http://activemq.apache.org/failover-transport-reference
这篇关于连接断开时,Apache.NMS.ActiveMQ客户端挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!