ActiveMq -Rejecting received message

    

 链接地址http://quentinXXZ.iteye.com/blog/2126684

 

    ActiveMq在stop操作,停止接收时,出现如下提示:

2014-09-23 20:26:23,233  WARN [ActiveMQ Session Task-1] (AbstractMessageListenerContainer.java:461) - Rejecting received message because of the listener container having been stopped in the meantime: ActiveMQTextMessage ....

     我开始怀疑是否存在消息丢失。

     经查询,做如下修改,将acceptMessageWhileStopping从false改为true就不再出现上述提示。对应的方法名为setAcceptMessagesWhileStop()

 官方说明如下:

 

Set whether to accept received messages while the listener container in the process of stopping.

Default is "false", rejecting such messages through aborting the receive attempt. Switch this flag on to fully process such messages even in the stopping phase, with the drawback that even newly sent messages might still get processed (if coming in before all receive timeouts have expired).

NOTE: Aborting receive attempts for such incoming messages might lead to the provider's retry count decreasing for the affected messages. If you have a high number of concurrent consumers, make sure that the number of retries is higher than the number of consumers, to be on the safe side for all potential stopping scenarios.

 

 

上述说明,仍无法确认是否真正的存在消息丢失。

后来做了下实验,将只开发送端,接收端不开,在Broker持久化一定量消息,再关闭发送端。acceptMessageWhileStopping设为false。启动接收端,并在其统计接收count,再做stop,出现上述的warn信息。再与activemq监控页面的count数据进行加减,对比,发现确实存在消息丢现象(当然也有可能跟具体的环境与代码有关)。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值