[rabbitmq-discuss] PRECONDITION_FAILED question
ku3ia
demesg at gmail.com
Tue Nov 12 18:11:16 GMT 2013
Hi, MK! Thanks for your post.
I wrote a code without my library, here is:
public void TestCode()
{
const string exchange = "x-nunit";
const string key = "key";
const string queue = "nunit-queue";
ConnectionFactory factory = new ConnectionFactory {Uri =
"amqp://guest:guest@127.0.0.1:5672/%2F"};
IConnection connection = factory.CreateConnection();
IModel channel = connection.CreateModel();
channel.ExchangeDeclare(exchange, ExchangeType.Direct);
channel.QueueDeclare(queue, true, false, false, null);
channel.QueueBind(queue, exchange, key);
try
{
channel.ExchangeDelete(exchange, true);
}
catch (Exception e)
{
System.IO.File.AppendAllText(@"F:\error.log", e.Message);
}
try
{
channel.QueueUnbind(queue, exchange, key, null);
}
catch (Exception e)
{
System.IO.File.AppendAllText(@"F:\error.log", e.Message);
}
channel.Close();
connection.Close();
}
F:\error.log:
The AMQP operation was interrupted: AMQP close-reason, initiated by Peer,
code=406, text="PRECONDITION_FAILED - exchange 'x-nunit' in vhost '/' in
use", classId=40, methodId=20, cause=
The AMQP operation was interrupted: AMQP close-reason, initiated by Peer,
code=406, text="PRECONDITION_FAILED - exchange 'x-nunit' in vhost '/' in
use", classId=40, methodId=20, cause=
RabbitMQ log:
=INFO REPORT==== 12-Nov-2013::19:58:26 ===
accepting AMQP connection <0.30470.9> (xxx:9421 -> yyy:5672)
=ERROR REPORT==== 12-Nov-2013::19:58:27 ===
connection <0.30470.9>, channel 1 - soft error:
{amqp_error,precondition_failed,"exchange 'x-nunit' in vhost '/' in use",
'exchange.delete'}
=INFO REPORT==== 12-Nov-2013::19:58:28 ===
closing AMQP connection <0.30470.9> (xxx:9421 -> yyy:5672)
But when I'm changing 'try/catch' vice-versa everything looks fine.
--
View this message in context: http://rabbitmq.1065348.n5.nabble.com/PRECONDITION-FAILED-question-tp31381p31385.html
Sent from the RabbitMQ mailing list archive at Nabble.com.
More information about the rabbitmq-discuss
mailing list