diff --git a/pkg/gps/GpsMessage.php b/pkg/gps/GpsMessage.php index b7e2bf484..8509698c4 100644 --- a/pkg/gps/GpsMessage.php +++ b/pkg/gps/GpsMessage.php @@ -24,6 +24,11 @@ class GpsMessage implements Message, \JsonSerializable */ private $headers; + /** + * @var array + */ + private $attributes = []; + /** * @var bool */ @@ -34,11 +39,12 @@ class GpsMessage implements Message, \JsonSerializable */ private $nativeMessage; - public function __construct(string $body = '', array $properties = [], array $headers = []) + public function __construct(string $body = '', array $properties = [], array $headers = [], array $attributes = []) { $this->body = $body; $this->properties = $properties; $this->headers = $headers; + $this->attributes = $attributes; $this->redelivered = false; } @@ -80,7 +86,7 @@ public function setHeaders(array $headers): void public function getHeaders(): array { - return $this->headers; + return array_merge($this->attributes, $this->headers); } public function setHeader(string $name, $value): void @@ -173,4 +179,20 @@ public function setNativeMessage(?GoogleMessage $message = null): void { $this->nativeMessage = $message; } + + /** + * @deprecated This will be removed in the V1, use headers instead + */ + public function setAttributes(array $attributes): void + { + $this->attributes = $attributes; + } + + /** + * @deprecated This will be removed in the V1, use headers instead + */ + public function getAttributes(): array + { + return $this->attributes; + } }