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

user1985899 picture user1985899 · Jan 19, 2013 · Viewed 21.6k times · Source

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=

Answer

Mike Hadlow picture Mike Hadlow · Jan 21, 2013

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.