在参考 Dead-Letter-Exchange 进行Dead-letter-exchange的理解,

在本地时,想要创建 Dead-letter-exchange 时,一直报错,错误如下:

Unhandled Exception: RabbitMQ.Client.Exceptions.OperationInterruptedException: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text="PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'q_test' in vhost '/': received the value 'q-dead-letter-exchange' of type 'longstr' but current is none", classId=50, methodId=10, cause=
at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply(TimeSpan timeout)
at RabbitMQ.Client.Impl.ModelBase.QueueDeclare(String queue, Boolean passive, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)
at RabbitMQ.Client.Impl.AutorecoveringModel.QueueDeclare(String queue, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)
at CNBlogs.Question.EventBusRabbitMQ.EventBusRabbitMQ.CreateConsumerChannel()

去官网查了查,姿势也正确,先声明一个Exchange

channel.ExchangeDeclare("q-dead-letter-exchange", type: "direct");

然后再指定 x-dead-letter-exchange 参数

var args = new Dictionary<string, object>()
{
{"x-dead-letter-exchange", "q-dead-letter-exchange"}
};

最后放到队列声明里面:

 channel.QueueDeclare(queue: _queueName,
durable: true,
exclusive: false,
autoDelete: false,
arguments: args);

然而,每次一运行就报上面那个错误,最后子啊Github上找到了答案

原因可能是我原来的队列中,因为有尚未确认的消息在。然后,把RabbitMQ 中的Queue 和Exchange 删除,重新运行程序就成功了。下面是Queue和Exchange 的截图

Solution for unable to create "dead-letter-exchange" in RabbitMQ的更多相关文章

  1. ORA-09925: Unable to create audit trail file汇总

    今天一兄弟的库报ORA-09925: Unable to create audit trail file,当时查 df -h有可用空间,文件夹的权限也正确,未df -i查看Inodes使用情况,审计文 ...

  2. ODA: After Apply ODA 12.2.1.2.0 Patch, Unable to Create TableSpace Due to [ORA-15001: diskgroup "DATA" does not exist or is not mounted | ORA-15040: diskgroup is incomplete] (Doc ID 2375553.1)

    ODA: After Apply ODA 12.2.1.2.0 Patch, Unable to Create TableSpace Due to [ORA-15001: diskgroup &quo ...

  3. Fatal error in launcher Unable to create process using 'dapppythonpython37python

    Fatal error in launcher: Unable to create process using '"d:\app\python\python37\python.exe&quo ...

  4. 【Azure 服务总线】Azure Service Bus中私信(DLQ - Dead Letter Queue)如何快速清理

    在博文ServiceBus 队列中死信(DLQ - Dead Letter Queue)问题一文中,介绍了服务总线产生私信的原因及可以通过代码的方式来清楚私信队列中的消息,避免长期占用空间(因为私信中 ...

  5. 记一次tomcat线程创建异常调优:unable to create new native thread

    测试在进行一次性能测试的时候发现并发300个请求时出现了下面的异常: HTTP Status 500 - Handler processing failed; nested exception is ...

  6. 解决Unable to create new native thread

    两种类型的Out of Memory java.lang.OutOfMemoryError: Java heap space error 当JVM尝试在堆中分配对象,堆中空间不足时抛出.一般通过设定J ...

  7. ArcEngine编辑保存错误:Unable to create logfile system tables

    通过ArcEngine对多个SDE中多个图层进行批量编辑处理,其中有部分图层在结束编辑的时候出现错误提示(部分图层可以,只有两个数据较多的图层保存失败). 错误信息:Unable to create ...

  8. Fatal error in launcher: Unable to create process using '"'

    今天遇到了 Fatal error in launcher: Unable to create process using '"' 这个问题,原来是我上次装python3.5的时候,pyth ...

  9. Genymotion创建下载模拟器的时候出现Unable to create Genymotion virtual devices:Connection timeout错误

    如图,如果Genymotion创建下载模拟器的时候出现Unable to create Genymotion virtual devices:Connection timeout错误,具体解决方法如下 ...

随机推荐

  1. iOS视频开发经验

    iOS视频开发经验 手机比PC的优势除了便携外,我认为最重要的就是可以快速方便的创作多媒体作品.照片分享,语音输入,视频录制,地理位置.一个成功的手机APP从产品形态上都有这其中的一项或多项,比如in ...

  2. vue2.0环境安装

    参考网站http://www.open-open.com/lib/view/open1476240930270.html (以上博客vue init webpack-simple 工程名字<工程 ...

  3. pl/sql Devloper 快捷键__新建sql窗口

    首先,打开PLSQL,菜单栏--->首选项----->键配置 其次,点击你要增加快捷键的选项,直接键盘上输入快捷键: 比如你要修改为CTRL+N,直接在键盘上按出CTRL+N即可. ESC ...

  4. move_base

    1>准备导航所需要的包. a.ros-indigo-gampping :我们不需要修改包内的东西,所以直接安装可执行文件就好了. sudo apt-get install ros-indigo- ...

  5. classfication中使用图像金字塔和sliding windows提高准确率

    之前对imagenet的预训模型进行finetune,找出了很多样本选择时的注意事项,当时在测试如下这张照片时,效果不好,我认为是物体过小造成的,因此尝试使用图像金字塔的方法: 当时结果如下: 一开始 ...

  6. C/C++杂记:深入虚表结构

    1. 虚表与“虚函数表” 在“C/C++杂记:虚函数的实现的基本原理”一文中曾提到“虚函数表”的概念,只是为了便于理解,事实是:虚函数表并不真的独立存在,它只是虚表(virtual table)中的一 ...

  7. Android Menu用法全面讲解

    说明:本文只介绍Android3.0及以上的Menu知识点. 菜单的分类 菜单是Android应用中非常重要且常见的组成部分,主要可以分为三类:选项菜单.上下文菜单/上下文操作模式以及弹出菜单.它们的 ...

  8. 小技巧css解决移动端ios不兼容position:fixed属性,无需插件

    移动端开发仿app头部底部固定设置position:fixed,android2.2以上已经实现.但是在ios8以下系统,当小键盘激活时,都会出现位置浮动问题.如图: 如何解决: 查阅资料之后想到一下 ...

  9. 洛谷P1638逛画展

    传送门啦 只需记录满足条件的一个区间的初始端点 $ (head, tail) $ ,不断删掉左端点 $ head $ ,不断更新右端点 $ tail $ : 开一个 $ vis[] $ 记录一下每幅画 ...

  10. PHP实现中文字符串截取无乱码

    在我们学习PHP知识的过程中,PHP截取字符串应该是一个非常常见的字符串基础操作了,想必大家都比较熟悉这方面知识点. 但是有些新手朋友们可能遇到过,当截取中英文字符串时出现乱码的情况,其实这个也是非常 ...