Skip to content

Commit

Permalink
Cancel consuming a queue once done
Browse files Browse the repository at this point in the history
  • Loading branch information
boekkooi committed Jun 17, 2015
1 parent f6db3d3 commit 89e2d24
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Command/QueueConsumeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

/**
Expand Down
2 changes: 2 additions & 0 deletions tests/Command/QueueConsumeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ function (callable $callback) {
} while (($callback($envelope, $queue)));
}
);
$queue
->shouldReceive('cancel');
return $queue;
}
}

0 comments on commit 89e2d24

Please sign in to comment.