Skip to content

Commit

Permalink
Throw exception of no consumer (#21)
Browse files Browse the repository at this point in the history
* Throw exception of no consumer

* Added changelog
  • Loading branch information
Nyholm committed Nov 2, 2016
1 parent 2cdfbe2 commit c4b75e8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.

## 0.2.3

### Added

- If no consumer is found we throw an exception to make sure we requeue the message.

## 0.2.2

### Added
Expand Down
11 changes: 3 additions & 8 deletions Service/ConsumerWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,10 @@ private function log($level, $message, array $context = [])
private function doConsume($queueName, $message, SerializedEnvelopeConsumer $consumer = null)
{
if ($consumer === null) {
$this->log(
'error',
sprintf('No consumer was found for queue named "%s"', $queueName),
[
'message' => $message,
]
);
$exceptionMessage = sprintf('No consumer was found for queue named "%s"', $queueName);
$this->log('alert', $exceptionMessage, ['message' => $message]);

return;
throw new \RuntimeException($exceptionMessage);
}

try {
Expand Down

0 comments on commit c4b75e8

Please sign in to comment.