@@ -34,10 +34,17 @@ class GpsMessage implements Message, \JsonSerializable
3434 */
3535 private $ nativeMessage ;
3636
37+ /**
38+ * @var array
39+ */
40+ private $ attributes ;
41+
3742 public function __construct (string $ body = '' , array $ properties = [], array $ headers = [])
3843 {
3944 $ this ->body = $ body ;
4045 $ this ->properties = $ properties ;
46+ $ this ->attributes = $ headers ['attributes ' ] ?? [];
47+ unset($ headers ['attributes ' ]);
4148 $ this ->headers = $ headers ;
4249
4350 $ this ->redelivered = false ;
@@ -103,7 +110,7 @@ public function isRedelivered(): bool
103110 return $ this ->redelivered ;
104111 }
105112
106- public function setCorrelationId (string $ correlationId = null ): void
113+ public function setCorrelationId (? string $ correlationId = null ): void
107114 {
108115 $ this ->setHeader ('correlation_id ' , $ correlationId );
109116 }
@@ -113,7 +120,7 @@ public function getCorrelationId(): ?string
113120 return $ this ->getHeader ('correlation_id ' );
114121 }
115122
116- public function setMessageId (string $ messageId = null ): void
123+ public function setMessageId (? string $ messageId = null ): void
117124 {
118125 $ this ->setHeader ('message_id ' , $ messageId );
119126 }
@@ -130,12 +137,12 @@ public function getTimestamp(): ?int
130137 return null === $ value ? null : (int ) $ value ;
131138 }
132139
133- public function setTimestamp (int $ timestamp = null ): void
140+ public function setTimestamp (? int $ timestamp = null ): void
134141 {
135142 $ this ->setHeader ('timestamp ' , $ timestamp );
136143 }
137144
138- public function setReplyTo (string $ replyTo = null ): void
145+ public function setReplyTo (? string $ replyTo = null ): void
139146 {
140147 $ this ->setHeader ('reply_to ' , $ replyTo );
141148 }
@@ -169,8 +176,13 @@ public function getNativeMessage(): ?GoogleMessage
169176 return $ this ->nativeMessage ;
170177 }
171178
172- public function setNativeMessage (GoogleMessage $ message = null ): void
179+ public function setNativeMessage (? GoogleMessage $ message = null ): void
173180 {
174181 $ this ->nativeMessage = $ message ;
175182 }
183+
184+ public function getAttributes (): array
185+ {
186+ return $ this ->attributes ;
187+ }
176188}
0 commit comments