[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;
}
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;
}