Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion AmqpContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public function deleteTopic(InteropAmqpTopic $topic): void

public function declareQueue(InteropAmqpQueue $queue): int
{
list(, $messageCount) = $this->getLibChannel()->queue_declare(
list($queueName, $messageCount) = $this->getLibChannel()->queue_declare(
$queue->getQueueName(),
(bool) ($queue->getFlags() & InteropAmqpQueue::FLAG_PASSIVE),
(bool) ($queue->getFlags() & InteropAmqpQueue::FLAG_DURABLE),
Expand All @@ -171,6 +171,16 @@ public function declareQueue(InteropAmqpQueue $queue): int
(bool) ($queue->getFlags() & InteropAmqpQueue::FLAG_NOWAIT),
$queue->getArguments() ? new AMQPTable($queue->getArguments()) : null
);
/*
* The queue name could have been entered as empty string, and come out in a format similar to:
* amq.gen-LQTh8IdojOCrvOnEuFog8w. The format of the automatically generated name is not in the spec, but the
* automatic generation is part of the amqp specification:
* https://www.rabbitmq.com/resources/specs/amqp0-9-1.xml (see methods declare and declare-ok)
*/
if ($queueName) {
$queue->setQueueName($queueName);
}


return $messageCount ?? 0;
}
Expand Down