Channel shutdown: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=

完整错误

CachingConnectionFactory.java:1278 - Channel shutdown: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - unknown delivery tag 1, class-id=60, method-id=80)

原因:消费者有ack确认,而spring-boot-starter-amqp默认是自动签收信息的方式,消费结果签收了两次,我们代码里面是写的手动签收,但是系统还有一次自动签收,所以就想到了是不是需要配置一下让rabbitmq手动签署,就不会触发自动签收的功能

channel.basicAck(message.getMessageProperties().getDeliveryTag(), true);

解决方法:去掉自动签收功能

spring:
  rabbitmq:
    host: 127.0.0.1
    port: 5672
    username: guest
    password: guest
    #消费端配置
    listener:
      simple:
        #自动签收auto  手动 manual
        acknowledge-mode: manual
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值