From 811c1e56229d7533b81fe454cf1460d7ef83a194 Mon Sep 17 00:00:00 2001 From: iamfarhad Date: Mon, 2 Jan 2023 11:04:41 +0330 Subject: [PATCH] fix critical bug in declare queues --- src/Consumer.php | 1 + src/RabbitQueue.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Consumer.php b/src/Consumer.php index 8ffff81..c31587a 100644 --- a/src/Consumer.php +++ b/src/Consumer.php @@ -72,6 +72,7 @@ public function daemon($connectionName, $queue, WorkerOptions $workerOptions) $jobsProcessed = 0; $connection = $this->manager->connection($connectionName); + $connection->declareQueue($queue); $this->amqpChannel = $connection->getChannel(); diff --git a/src/RabbitQueue.php b/src/RabbitQueue.php index f49e8c8..ac122b2 100644 --- a/src/RabbitQueue.php +++ b/src/RabbitQueue.php @@ -400,7 +400,7 @@ private function createMessage($payload, int $attempts = 2): array ]; } - private function publishProperties(string $queue = '', array $options = []): array + private function publishProperties(?string $queue = null, array $options = []): array { $queue = $this->getQueue($queue); $attempts = Arr::get($options, 'attempts') ?: 0;