jeecgboot / JeecgBoot

🔥「企业级低代码平台」前后端分离架构SpringBoot 2.x/3.x,SpringCloud,Ant Design&Vue3,Mybatis,Shiro,JWT。强大的代码生成器让前后端代码一键生成,无需写任何代码! 引领新的开发模式,引入AI模型能力 OnlineCoding->代码生成->手工MERGE,帮助Java项目解决70%重复工作,让开发更关注业务,既能快速提高效率,帮助公司节省成本,同时又不失灵活性。
http://www.jeecg.com
Apache License 2.0
40.7k stars 14.85k forks source link

rabbitmq报错acknowledge-mode: manual配置不生效 #6188

Closed kong876 closed 4 months ago

kong876 commented 6 months ago
版本号:spring3版本 项目地址是https://github.com/jeecgboot/jeecg-boot
分支:

master

问题描述:

使用rabbitmq的 消费端手动ack消息,nacos配置已修改为acknowledge-mode: manual,但是使用channel.basicAck(deliveryTag, false);手动ack消息的时候报错,好像是manual配置没生效或者被覆盖掉了

报错信息如下:

2024-04-28 13:33:00.969 [http-nio-7001-exec-3] INFO o.j.boot.starter.rabbitmq.client.RabbitMqClient:203 - 发送消息到mq 2024-04-28 13:33:01.147 [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer#1-2] INFO org.jeecg.modules.system.listener.PicQueueListener:35 - [图像识别算法处理器] deviceCode:DWQ001,deviceCode1:,requestString:req,parkingString:parking 2024-04-28 13:33:01.153 [AMQP Connection 115.216.25.87:5672] ERROR o.s.a.rabbit.connection.CachingConnectionFactory:752 - Shutdown Signal: channel error; protocol method: #method(reply-code=406, reply-text=PRECONDITION_FAILED - unknown delivery tag 1, class-id=60, method-id=80) 2024-04-28 13:33:02.151 [org.springframework.amqp.rabbit.RabbitListenerEndpointContainer#1-2] INFO o.s.a.r.listener.SimpleMessageListenerContainer:1463 - Restarting Consumer@efbdd39: tags=[[amq.ctag-DjCbbXdjn4mOntf_ICkMFA]], channel=Cached Rabbit Channel: PublisherCallbackChannelImpl: AMQChannel(amqp://dingqi@115.216.25.87:5672/,7), conn: Proxy@7239f4ba Shared Rabbit Connection: SimpleConnection@64c457f0 [delegate=amqp://dingqi@115.216.25.87:5672/, localPort= 31367], acknowledgeMode=AUTO local queue size=0

截图&代码:

image image image image

zhangdaiscott commented 6 months ago

版本号多少?

kong876 commented 6 months ago

版本号是3.6.3 不知道是不是没安装rabbitmq_delayed_message_exchange插件的原因, centos7.9的系统试了好几种方法都没安装上这个插件 所以少了jeecg.delayed.exchange

kong876 commented 6 months ago

初始化队列的时候ackmode没带上 是这个原因吗 初始化队列....class........rabbitListener=@org.springframework.amqp.rabbit.annotation.RabbitListener(queuesToDeclare=[], containerFactory=, converterWinsContentType=true, bindings=[], messageConverter=, admin=, replyContentType=, priority=, autoStartup=, concurrency=, executor=, queues=[pic_queue], replyPostProcessor=, returnExceptions=, ackMode=, exclusive=false, errorHandler=, id=, group=)

kong876 commented 6 months ago

版本号多少? 版本号是3.6.3 不知道是不是没安装rabbitmq_delayed_message_exchange插件的原因, centos7.9的系统试了好几种方法都没安装上这个插件 所以少了jeecg.delayed.exchange 初始化队列的时候ackmode没带上 是这个原因吗 初始化队列....class........rabbitListener=@org.springframework.amqp.rabbit.annotation.RabbitListener(queuesToDeclare=[], containerFactory=, converterWinsContentType=true, bindings=[], messageConverter=, admin=, replyContentType=, priority=, autoStartup=, concurrency=, executor=, queues=[pic_queue], replyPostProcessor=, returnExceptions=, ackMode=, exclusive=false, errorHandler=, id=, group=)

kong876 commented 6 months ago

版本号多少?

而且我把这两个模块的依赖改了一下 没有用rabbitmq的test模块 image

zhangdaiscott commented 6 months ago

延迟队列必须安装

kong876 commented 6 months ago

延迟队列必须安装

延迟队列安装好了 试了一下跟刚才一样,也尝试过@RabbitListener(queues = CommonConstant.PIC_QUEUE,ackMode = "MANUAL") 也是没效果 image

zhangdaiscott commented 6 months ago

zj

EightMonth commented 5 months ago

根本原因为进行了double ack,jeecg-starter-rabbitmq在代码中已经进行了手动ack,但如果用户再次进行手动ack就会导致该错误。

解决办法:去除手动ack的代码即可