Active MQ专题:1. 什么场景会导致消费重试

官网是这么说的(http://activemq.apache.org/message-redelivery-and-dlq-handling.html)
1.A transacted session is used and rollback() is called.(使用了事务且调用了rollback)
2.A transacted session is closed before commit() is called.(使用了事务且在commit之前,事务关闭)
3.A session is using CLIENT_ACKNOWLEDGE and Session.recover() is called.(CLIENT_ACKNOWLEDGE +Session.recover)
4.A client connection times out (perhaps the code being executed takes longer than the configured time-out period).
(其实就是超时ACK)

什么是事务呢?
activemq的事务可以参照数据库的事务的概念,就是一批消息,要么都成功,要么都失败。
activemq的事务分为生产者事务与消费者事务。对应发送和消费
消费代码主要见ActiveMQMessageConsumer类,分两种方式,同步消费,异步消费
消费过程可以见别人的文章https://blog.csdn.net/weisong530624687/article/details/70210168

你可能感兴趣的:(Active MQ专题:1. 什么场景会导致消费重试)