简体   繁体   English

将消息发送到队列时出错

[英]Error sending message to queue

I'm using EasyNetQ to send a message in a queue of rabbit. 我正在使用EasyNetQ在兔子队列中发送消息。

I have a code like this 我有这样的代码

using (var bus = RabbitHutch.CreateBus("MyConnection"))
{                
       bus.Send("MyCodeName", "MyClass");
}

the connection is open when I create the bus, but there is this error when I send the message 创建总线时,连接已打开,但是发送消息时出现此错误

The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text="PRECONDITION_FAILED - inequivalent arg 'x-max-priority' for queue ....: received none but current is the value '10' of type 'long'", classId=50, methodId=10, cause= AMQP操作被中断:AMQP关闭原因,由Peer发起,代码= 406,文本=“ PRECONDITION_FAILED-队列....的等价arg'x-max-priority':没有收到,但当前值为'10'类型为'long'“,classId = 50,methodId = 10,cause =

I setup the queue with x-max-priority: 10. I have to setup anything else in the connection string? 我使用x-max-priority设置了队列:10.是否必须在连接字符串中设置其他内容?

I have resolved without using Send method 我没有使用Send方法就解决了

EasyNetQ EasyNetQ

Infact the send method, tries to create a queue before send message. 影响send方法,尝试在发送消息之前创建队列。 I have used the publish method 我已经使用了发布方法

Delete the queue/exchange first and try again. 首先删除队列/交换,然后重试。

Don't use 'using' around the bus instance, instead instantiate it once in your application and dispose on quit. 不要在总线实例周围使用“ using”,而是在您的应用程序中实例化一次并丢弃。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM