diff --git a/src/Message/Contract/Message.php b/src/Message/Contract/Message.php index 5e48a84..575dce0 100644 --- a/src/Message/Contract/Message.php +++ b/src/Message/Contract/Message.php @@ -6,5 +6,5 @@ interface Message { - public function getBody(): array; + public function getBody(): ?array; } diff --git a/src/Message/RabbitMQMessage.php b/src/Message/RabbitMQMessage.php index 69505b1..5248500 100644 --- a/src/Message/RabbitMQMessage.php +++ b/src/Message/RabbitMQMessage.php @@ -20,7 +20,7 @@ public function __construct(AMQPMessage $message) $this->message = $message; } - public function getBody(): array + public function getBody(): ?array { return json_decode($this->message->getBody(), true); } diff --git a/src/Message/SQSMessage.php b/src/Message/SQSMessage.php index 14243c4..9c299f2 100644 --- a/src/Message/SQSMessage.php +++ b/src/Message/SQSMessage.php @@ -18,13 +18,18 @@ public function __construct(array $message) $this->message = $message; } - public function getBody(): array + public function getBody() : ?array { return json_decode($this->message['Body'], true); } - public function getReceiptHandle(): string + public function getReceiptHandle() : string { return $this->message['ReceiptHandle']; } + + public function getRawMessage() : array + { + return $this->message; + } }