@@ -34,10 +34,17 @@ class GpsMessage implements Message, \JsonSerializable
34
34
*/
35
35
private $ nativeMessage ;
36
36
37
+ /**
38
+ * @var array
39
+ */
40
+ private $ attributes ;
41
+
37
42
public function __construct (string $ body = '' , array $ properties = [], array $ headers = [])
38
43
{
39
44
$ this ->body = $ body ;
40
45
$ this ->properties = $ properties ;
46
+ $ this ->attributes = $ headers ['attributes ' ] ?? [];
47
+ unset($ headers ['attributes ' ]);
41
48
$ this ->headers = $ headers ;
42
49
43
50
$ this ->redelivered = false ;
@@ -103,7 +110,7 @@ public function isRedelivered(): bool
103
110
return $ this ->redelivered ;
104
111
}
105
112
106
- public function setCorrelationId (string $ correlationId = null ): void
113
+ public function setCorrelationId (? string $ correlationId = null ): void
107
114
{
108
115
$ this ->setHeader ('correlation_id ' , $ correlationId );
109
116
}
@@ -113,7 +120,7 @@ public function getCorrelationId(): ?string
113
120
return $ this ->getHeader ('correlation_id ' );
114
121
}
115
122
116
- public function setMessageId (string $ messageId = null ): void
123
+ public function setMessageId (? string $ messageId = null ): void
117
124
{
118
125
$ this ->setHeader ('message_id ' , $ messageId );
119
126
}
@@ -130,12 +137,12 @@ public function getTimestamp(): ?int
130
137
return null === $ value ? null : (int ) $ value ;
131
138
}
132
139
133
- public function setTimestamp (int $ timestamp = null ): void
140
+ public function setTimestamp (? int $ timestamp = null ): void
134
141
{
135
142
$ this ->setHeader ('timestamp ' , $ timestamp );
136
143
}
137
144
138
- public function setReplyTo (string $ replyTo = null ): void
145
+ public function setReplyTo (? string $ replyTo = null ): void
139
146
{
140
147
$ this ->setHeader ('reply_to ' , $ replyTo );
141
148
}
@@ -169,8 +176,13 @@ public function getNativeMessage(): ?GoogleMessage
169
176
return $ this ->nativeMessage ;
170
177
}
171
178
172
- public function setNativeMessage (GoogleMessage $ message = null ): void
179
+ public function setNativeMessage (? GoogleMessage $ message = null ): void
173
180
{
174
181
$ this ->nativeMessage = $ message ;
175
182
}
183
+
184
+ public function getAttributes (): array
185
+ {
186
+ return $ this ->attributes ;
187
+ }
176
188
}
0 commit comments