Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kong876 opened this issue Apr 28, 2024 · 9 comments
Open

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

kong876 opened this issue Apr 28, 2024 · 9 comments

Comments

@kong876
Copy link

kong876 commented Apr 28, 2024

版本号: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<channel.close>(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
Copy link
Member

版本号多少?

@kong876
Copy link
Author

kong876 commented Apr 28, 2024

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

@kong876
Copy link
Author

kong876 commented Apr 28, 2024

初始化队列的时候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
Copy link
Author

kong876 commented Apr 28, 2024

版本号多少?
版本号是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
Copy link
Author

kong876 commented Apr 28, 2024

版本号多少?

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

@zhangdaiscott
Copy link
Member

延迟队列必须安装

@kong876
Copy link
Author

kong876 commented Apr 28, 2024

延迟队列必须安装

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

@zhangdaiscott
Copy link
Member

zhangdaiscott commented May 11, 2024

zj

@EightMonth
Copy link
Contributor

EightMonth commented May 23, 2024

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants