From bc4df30cfe1141975e26d3d60ebdd0df8a7d8433 Mon Sep 17 00:00:00 2001 From: Viacheslav Shcherbyna Date: Tue, 23 Sep 2025 15:43:45 +0300 Subject: [PATCH] SWR-19884 #comment Change RabbitMQ Queues Policies --- README.md | 4 ++-- composer.json | 2 +- src/VhostsConsumers/AbstractVhostsConsumer.php | 2 ++ src/VhostsConsumers/DirectConsumer.php | 8 +++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 4bb8f78c..6415ca98 100644 --- a/README.md +++ b/README.md @@ -11,14 +11,14 @@ Only the latest version will get new features. Bug fixes will be provided using | Package Version | Laravel Version | Bug Fixes Until | | |-----------------|-----------------|----------------------|---------------------------------------------------------------------------------------------| -| 1 | 27 | September 16th, 2025 | [Documentation](https://github.com/vyuldashev/laravel-queue-rabbitmq/blob/master/README.md) | +| 1 | 28 | September 23th, 2025 | [Documentation](https://github.com/vyuldashev/laravel-queue-rabbitmq/blob/master/README.md) | ## Installation You can install this package via composer using this command: ``` -composer require salesmessage/php-lib-rabbitmq:^1.27 --ignore-platform-reqs +composer require salesmessage/php-lib-rabbitmq:^1.28 --ignore-platform-reqs ``` The package will automatically register itself. diff --git a/composer.json b/composer.json index d457561a..c7fadad7 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.27-dev" + "dev-master": "1.28-dev" }, "laravel": { "providers": [ diff --git a/src/VhostsConsumers/AbstractVhostsConsumer.php b/src/VhostsConsumers/AbstractVhostsConsumer.php index 8394177c..b3f0941b 100644 --- a/src/VhostsConsumers/AbstractVhostsConsumer.php +++ b/src/VhostsConsumers/AbstractVhostsConsumer.php @@ -8,6 +8,7 @@ use Illuminate\Queue\QueueManager; use Illuminate\Queue\WorkerOptions; use Illuminate\Support\Str; +use PhpAmqpLib\Channel\AMQPChannel; use PhpAmqpLib\Connection\AMQPStreamConnection; use PhpAmqpLib\Exception\AMQPChannelClosedException; use PhpAmqpLib\Exception\AMQPConnectionClosedException; @@ -651,6 +652,7 @@ protected function initConnection(): RabbitMQQueue ); try { + /** @var AMQPChannel $channel */ $channel = $connection->getChannel(true); $this->currentConnectionName = $connection->getConnectionName(); diff --git a/src/VhostsConsumers/DirectConsumer.php b/src/VhostsConsumers/DirectConsumer.php index 205a78cd..ecdae23c 100644 --- a/src/VhostsConsumers/DirectConsumer.php +++ b/src/VhostsConsumers/DirectConsumer.php @@ -41,6 +41,9 @@ protected function vhostDaemon($connectionName, WorkerOptions $options) try { $this->connectionMutex->lock(self::MAIN_HANDLER_LOCK); $amqpMessage = $this->channel->basic_get($this->currentQueueName); + if (null !== $amqpMessage) { + $this->channel->basic_reject($amqpMessage->getDeliveryTag(), false); + } $this->connectionMutex->unlock(self::MAIN_HANDLER_LOCK); } catch (AMQPProtocolChannelException|AMQPChannelClosedException $exception) { $amqpMessage = null; @@ -112,11 +115,6 @@ protected function startConsuming(): RabbitMQQueue $this->logInfo('startConsuming.init'); - $arguments = []; - if ($this->maxPriority) { - $arguments['priority'] = ['I', $this->maxPriority]; - } - $this->jobsProcessed = 0; $connection = $this->initConnection();