Skip to content

Commit

Permalink
Merge pull request #15 from sroze/proper-consumer-return
Browse files Browse the repository at this point in the history
Updates the return value to match with the OldSound bundle
  • Loading branch information
matthiasnoback committed Sep 29, 2015
2 parents 34581c2 + fa6498c commit dca0bdd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/RabbitMQMessageConsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ public function execute(AMQPMessage $msg)
new MessageConsumed($msg)
);

return self::MSG_ACK;
return true;
} catch (Exception $exception) {
$this->eventDispatcher->dispatch(
Events::MESSAGE_CONSUMPTION_FAILED,
new MessageConsumptionFailed($msg, $exception)
);

return self::MSG_REJECT;
return false;
}
}
}
4 changes: 2 additions & 2 deletions tests/RabbitMQMessageConsumerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function it_consumes_the_message_body_as_a_serialized_envelope()
$consumer = new RabbitMQMessageConsumer($serializedEnvelopeConsumer, $eventDispatcher);

$result = $consumer->execute($message);
$this->assertSame(ConsumerInterface::MSG_ACK, $result);
$this->assertSame(true, $result);
}

/**
Expand All @@ -50,7 +50,7 @@ public function it_handles_an_error_but_throws_no_exception_if_consuming_the_mes
$consumer = new RabbitMQMessageConsumer($serializedEnvelopeConsumer, $eventDispatcher);

$result = $consumer->execute($message);
$this->assertSame(ConsumerInterface::MSG_REJECT, $result);
$this->assertSame(false, $result);
}

private function newAMQPMessage($messageBody = '')
Expand Down

0 comments on commit dca0bdd

Please sign in to comment.