Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create a durable queue #731

Closed
BlackZork opened this issue Aug 30, 2019 · 1 comment
Closed

Cannot create a durable queue #731

BlackZork opened this issue Aug 30, 2019 · 1 comment

Comments

@BlackZork
Copy link

Hi,

I am using rabbitmq:3.7-management docker image and php-amaqplib 2.8.0.
I am unable to create durable queue. Code:

            $connection = new AMQPStreamConnection($this->rabbitHost, $this->rabbitPort, $this->rabbitUser, $this->rabbitPass);
            $channel = $connection->channel();
            $queue_name = 'myqueue';
            $channel->queue_declare($queue=$queue_name, $durable=TRUE, $autodelete=FALSE);

This returns errors:

Fatal error: Uncaught PhpAmqpLib\Exception\AMQPProtocolChannelException: NOT_FOUND - no queue 'myqueue' in vhost '/' in /var/www/html/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Channel/AMQPChannel.php on line 188

( ! ) PhpAmqpLib\Exception\AMQPProtocolChannelException: NOT_FOUND - no queue 'myqueue' in vhost '/' in /var/www/html/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Channel/AMQPChannel.php on line 188

When I set durable to FALSE then queue is created.
I can also send messages to durable queue created from web interface.

Any idea why I cannot create a durable queue?

@ramunasd
Copy link
Member

Hello @BlackZork ,
looks like You came from python world where You can specify function arguments in any order. But this is not true in PHP world. Also, You don't need to do something like $queue=$queue_name, just pass variables in correct order and everything will be ok.

Here is demo https://github.com/php-amqplib/php-amqplib/blob/master/demo/amqp_publisher.php#L22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants