【RabbitMQ】延迟队列报错(NO_ROUTE)

文章目录

一、背景

  1. 使用rabbitmq-delayed-message-exchange延迟队列插件
  2. 设置Mandatory=true,消息无法路由。报错:NO_ROUTE

二、原因

  • 官方说明
  • https://github.com/rabbitmq/rabbitmq-delayed-message-exchange
    在这里插入图片描述

解读如下:

Delayed messages are stored in a Mnesia table (also see Limitations below) with a single disk replica on the current node

延时队列的消息都是存储在磁盘中

The plugin only performs one attempt at publishing each message but since publishing is local, in practice the only issue that may prevent delivery is the lack of queues (or bindings) to route to.

Closely related to the above, the mandatory flag is not supported by this exchange: we cannot be sure that at the future publishing point in time

there is at least one queue we can route to
the original connection is still around to send a basic.return to

延时消息是从磁盘读取消息然后发送(后台任务),发送消息的时候无法保证两点:

  • 1、发送时消息路由的队列还存在
  • 2、发送时原连接仍然支持回调方法
  • 原因:消息写磁盘和从磁盘读取消息发送存在时间差,两个时间点的队列和连接情况可能不同。所以不支持Mandatory设置

三、解决方法

  1. 往延时队列发消息前设置Mandatory=false

四、参考资料

  1. https://github.com/rabbitmq/rabbitmq-delayed-message-exchange
  2. https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/issues/138
  3. https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/issues/7
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值