diff --git a/src/Command/QueueConsumeCommand.php b/src/Command/QueueConsumeCommand.php index c40affc..c35ab5a 100644 --- a/src/Command/QueueConsumeCommand.php +++ b/src/Command/QueueConsumeCommand.php @@ -55,6 +55,12 @@ function (\AMQPEnvelope $envelope, \AMQPQueue $queue) use ($commandBus, &$limit) return $limit > 0; } ); + + # Cancel consumption of the queue + $consumeQueue->cancel(); + foreach ($queues as $queue) { + $queue->cancel(); + } } /** diff --git a/tests/Command/QueueConsumeCommandTest.php b/tests/Command/QueueConsumeCommandTest.php index e93871c..f00cb38 100644 --- a/tests/Command/QueueConsumeCommandTest.php +++ b/tests/Command/QueueConsumeCommandTest.php @@ -151,6 +151,8 @@ function (callable $callback) { } while (($callback($envelope, $queue))); } ); + $queue + ->shouldReceive('cancel'); return $queue; } }