Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exception 'The AMQP operation was interrupted' (code=406) occurs in .NET Client programming

I have a 2.8.2 RabbitMQ Server and a 2.8.2 client dll, have the code to declare a queue and get a message, it works correctly (all parameters are correct):

IModel channel=null;

ConnectionFactory factory = new ConnectionFactory ();
factory.HostName = "192.168.68.4";
_QueueName = "172.16.1.1";

factory.UserName = "guest";
factory.Password = "guest";
factory.VirtualHost = "/";

factory.RequestedHeartbeat = 30;

if (factory.Endpoint == null) {
    Console.WriteLine (" factory.Endpoint==null ");
}


// 接受消息的队列名称是本地的IP地址
_QueueName = "172.16.1.1";
_RMQConnection = factory.CreateConnection ();

Console.WriteLine ("factory.CreateConnection()");

channel = _RMQConnection.CreateModel ();

channel.QueueDeclare(_QueueName, false, false,false,null);

But when I download 3.0.1 RabbitMQ Server and a 3.0.1 client dll, I use the same code and have the exception:

The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text="PRECONDITION_FAILED - parameters for queue '172.16.1.1' in vhost '/' not equivalent", classId=50, methodId=10, cause=

like image 825
user1985899 Avatar asked Jan 19 '13 04:01

user1985899


1 Answers

You typically get that error message when you re-declare an existing queue with different parameters. Check in the management console to see if the queue already exists. If it does, try deleting it and then re-running your code.

like image 53
Mike Hadlow Avatar answered Nov 18 '22 12:11

Mike Hadlow