diff --git a/Service/BaseQueue.php b/Service/BaseQueue.php index 9477e9b..28fac0d 100644 --- a/Service/BaseQueue.php +++ b/Service/BaseQueue.php @@ -143,6 +143,7 @@ public function receiveMessage(int $limit = 1) ->setBody($message['Body']) ->setReceiptHandle($message['ReceiptHandle']) ->setAttributes($message['Attributes']) + ->setMessageAttributes($message['MessageAttributes'] ?? []) ); } } catch (AwsException $e) { diff --git a/Service/Message.php b/Service/Message.php index b8bd7df..16fca83 100644 --- a/Service/Message.php +++ b/Service/Message.php @@ -23,6 +23,11 @@ class Message */ private $attributes; + /** + * @var array + */ + private $messageAttributes; + /** * @var string */ @@ -49,11 +54,13 @@ class Message public function __construct( string $body = '', array $attributes = [], + array $messageAttributes = [], string $groupId = '', string $deduplicationId = '' ) { $this->body = $body; $this->attributes = $attributes; + $this->messageAttributes = $messageAttributes; $this->groupId = $groupId; $this->deduplicationId = $deduplicationId; } @@ -118,6 +125,26 @@ public function setAttributes(array $attributes) return $this; } + /** + * @return array + */ + public function getMessageAttributes(): array + { + return $this->messageAttributes; + } + + /** + * @param array $messageAttributes + * + * @return Message + */ + public function setMessageAttributes(array $messageAttributes) + { + $this->messageAttributes = $messageAttributes; + + return $this; + } + /** * @return string */