[rabbitmq-discuss] [Error] PRECONDITION_FAILED

Simon MacMullen simon at rabbitmq.com
Wed Oct 23 16:10:12 BST 2013


I don't know whether the php client eats the error description or you 
just didn't post it, but the PRECONDITION_FAILED is telling you that you 
can't declare an exchange with the characteristics you asked for, since 
it already exists but with different characteristics. i.e. it might not 
be durable, or be of a different type, or might not be auto-delete.

My money's on auto-delete for what it's worth.

rabbitmqctl list_exchanges or the management plugin will let you see 
what form the exchange currently takes.

Cheers, Simon

On 23/10/13 13:18, Axansh Sheth wrote:
> Hi,
>
> I wanted to upgrade AMQP library [php] 0.9 to latest.
> I have updated that and change my Publisher and consumer code.
>
> In publisher code for 0.9 :
>
> $this->ex = new AMQPExchange($conn);
> $this->ex->declare($exchange, $type);
>
> I changed it :
>
> $this->ex = new AMQPExchange($ch);
> $this->ex->setName($exchange);
> $this->ex->setType($type);
> $this->ex->setFlags(AMQP_DURABLE | AMQP_AUTODELETE);
> $this->ex->declare();
>
> But i got this error : ncaught exception 'AMQPExchangeException' with
> message 'Server channel error: 406, message: PRECONDITION_FAILED
>
> If i commented $this->ex->declare();
> then works fine,
>
> I found this is redeclare problem.
>
> Shall i comment : $this->ex->declare(); or
> shall i change some thing?
>
> I do not loose my earlier functionality.
>
> Please guide me for same.
>
> Thanks a lot.
>
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>


-- 
Simon MacMullen
RabbitMQ, Pivotal


More information about the rabbitmq-discuss mailing list