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


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值