activemq broker连接failover参数设置

最近项目中遇到一个问题,和下面这个歪果博客经历一样

If I try to connect to a dead broker:
failover:tcp://localhost:61617
it blocks forever on:
ActiveMQConnectionFactory connectionFactory::setClientID
if I force it to not block:
failover:tcp://localhost:61617?startupMaxReconnectAttempts=1&initialReconnectDelay=10
it still blocks.
Am I missing something?

在activemq broker连接不上,启动应用时,竟然配置的startupMaxReconnectAttempts=2&timeout=2000参数一点用都没有,还是华丽丽导致整个应用都启动不了,最后加上maxReconnectAttempts=3才使得应用启动起来。。。

startupMaxReconnectAttempts:默认为0。如果该值不为0,表示客户端接收到消息服务器发送来的错误消息之前尝试连接服务器的最大次数,一旦成功连接后,maxReconnectAttempts值开始生效,如果该值为0,则默认采用maxReconnectAttempts。

timeout:默认为-1,单位毫秒,是否允许在重连过程中设置超时时间来中断正在阻塞的发送操作。-1表示不允许,其他表示超时时间。

maxReconnectAttempts:5.6版本之前默认为-1,5.6版本及其以后,默认为0。0表示重连的次数无限,配置大于0可以指定最大重连次数。

有没有哪位大神通俗易懂地解释下startupMaxReconnectAttemptsmaxReconnectAttempts


你可能感兴趣的:(web,activemq)