Skip to content

Commit

Permalink
Merge pull request #8 from SykesCottages/add-extra-option
Browse files Browse the repository at this point in the history
Expose the raw message for sqs
  • Loading branch information
exussum12 authored Sep 6, 2019
2 parents c552ec4 + c2974ca commit f7d1e65
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Message/Contract/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

interface Message
{
public function getBody(): array;
public function getBody(): ?array;
}
2 changes: 1 addition & 1 deletion src/Message/RabbitMQMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
9 changes: 7 additions & 2 deletions src/Message/SQSMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit f7d1e65

Please sign in to comment.