Frage

I'm trying to set AMQP_AUTODELETE flag on my exchange using AMQPExchange::setFlags ( int $flags )

http://php.net/manual/en/amqp.constants.php http://www.php.net/manual/en/amqpexchange.setflags.php

does not work... :(

$exchange = new \AMQPExchange(new \AMQPChannel($this->_connection));

$exchange->setName($name);
$exchange->setType(AMQP_EX_TYPE_FANOUT);

$exchange->setFlags(AMQP_AUTODELETE);
$exchange->declare();

$exchange->getFlags() returns 0 instead of 16 (integer value of AMQP_AUTODELETE).

But it works when I set AMQP_DURABLE flag the same way, $exchange->getFlags() returns 2.

Has anyone found a solution for this ? Thanks!!!

War es hilfreich?

Lösung

AMQP_AUTODELETE flag can only be used for AMQPQueue. See the AMQPExchange::setFlags manual page for valid flags.

Andere Tipps

I'm having the same problem. Exchanges with auto-delete cannot be created using current php amqp module (v1.2.0).

There is recent commit in dev-master (1.4.0-dev) that is adding this functionality. Still, I was not able to make it work. I see that exchange object is having auto_delete attribute, but when it is declared, in rabbitmq (v3.1.3) it is having auto_delete flag set to false.

For now I will create cronjob, that will delete exchanges that don't have related queue.

This is answer for your question and also collaboration request. Any input about this topic is welcome.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top