消费消息事务发生回滚-消息转发到DLQ 死信队列

[color=red]没有被持久化的消息,在消息消费时候出现回滚时,消息将丢失。不会转发到死信队列中去,即默认的全局死信队列"ActiveMQ.DLQ"[/color]
1.org.apache.activemq.broker.region.PrefetchSubscription 类
方法:
public final void acknowledge(final ConnectionContext context,final MessageAck ack) throws Exception
第356行
...
if (inAckRange) {
sendToDLQ(context, node);
...
第460行
protected void sendToDLQ(final ConnectionContext context, final MessageReference node) throws IOException, Exception {
broker.sendToDeadLetterQueue(context, node);
}

2.org.apache.activemq.broker.region.RegionBroker 类
方法:
public void sendToDeadLetterQueue(ConnectionContext context,
MessageReference node)
第679行
if(deadLetterStrategy.isSendToDeadLetterQueue(message))

3.org.apache.activemq.broker.region.policy.AbstractDeadLetterStrategy 类
方法:
public boolean isSendToDeadLetterQueue(Message message) {
boolean result = false;
if (message != null) {
result = true;
if (!message.isPersistent() && !processNonPersistent) {
result = false;
}
if (message.isExpired() && !processExpired) {
result = false;
}
}
return result;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值