Domanda

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!!!

È stato utile?

Soluzione

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

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top