From c2974ca34caffb078b6ce0f41be3c06aa9e56e30 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Fri, 6 Sep 2019 16:24:05 +0100 Subject: [PATCH] Expose the raw message for sqs --- src/Message/Contract/Message.php | 2 +- src/Message/RabbitMQMessage.php | 2 +- src/Message/SQSMessage.php | 9 +++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) 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; + } }