From 49c6d29ca2dbd776b78279966eea0772cf4dacdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Hub=C3=ADk?= Date: Thu, 20 Apr 2023 09:18:38 +0200 Subject: [PATCH 1/2] Allow using nette/utils ^4.0 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7e7f9a9b..7aa754e6 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "require": { "php": "^7.4 | ^8.0", "nette/di": "^3.0", - "nette/utils": "^3.0", + "nette/utils": "^3.0 || ^4.0", "php-amqplib/php-amqplib": "~3.1.0" }, "require-dev": { From 5f57ab1673735b68049a0364a84f39e53278e0fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Hub=C3=ADk?= Date: Wed, 26 Apr 2023 11:57:22 +0200 Subject: [PATCH 2/2] Multiple consumer stop consuming after number of messages received fix --- src/Kdyby/RabbitMq/MultipleConsumer.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Kdyby/RabbitMq/MultipleConsumer.php b/src/Kdyby/RabbitMq/MultipleConsumer.php index c81cdfba..32cb37d9 100644 --- a/src/Kdyby/RabbitMq/MultipleConsumer.php +++ b/src/Kdyby/RabbitMq/MultipleConsumer.php @@ -73,6 +73,14 @@ protected function queueDeclare(): void $this->queueDeclared = TRUE; } + public function stopConsuming(): void + { + foreach ($this->queues as $name => $options) { + $this->getChannel()->basic_cancel($this->getQueueConsumerTag($name)); + } + $this->onStop($this); + } + public function processQueueMessage(string $queueName, AMQPMessage $msg): void { if (!isset($this->queues[$queueName])) {