@@ -26,6 +26,37 @@ final class ReceiveMessageRequest extends Input
26
26
*/
27
27
private $ attributeNames ;
28
28
29
+ /**
30
+ * A list of attributes that need to be returned along with each message. These attributes include:
31
+ *
32
+ * - `All` – Returns all values.
33
+ * - `ApproximateFirstReceiveTimestamp` – Returns the time the message was first received from the queue (epoch time
34
+ * [^1] in milliseconds).
35
+ * - `ApproximateReceiveCount` – Returns the number of times a message has been received across all queues but not
36
+ * deleted.
37
+ * - `AWSTraceHeader` – Returns the X-Ray trace header string.
38
+ * - `SenderId`
39
+ *
40
+ * - For a user, returns the user ID, for example `ABCDEFGHI1JKLMNOPQ23R`.
41
+ * - For an IAM role, returns the IAM role ID, for example `ABCDE1F2GH3I4JK5LMNOP:i-a123b456`.
42
+ *
43
+ * - `SentTimestamp` – Returns the time the message was sent to the queue (epoch time [^2] in milliseconds).
44
+ * - `SqsManagedSseEnabled` – Enables server-side queue encryption using SQS owned encryption keys. Only one
45
+ * server-side encryption option is supported per queue (for example, SSE-KMS [^3] or SSE-SQS [^4]).
46
+ * - `MessageDeduplicationId` – Returns the value provided by the producer that calls the `SendMessage` action.
47
+ * - `MessageGroupId` – Returns the value provided by the producer that calls the `SendMessage` action. Messages with
48
+ * the same `MessageGroupId` are returned in sequence.
49
+ * - `SequenceNumber` – Returns the value provided by Amazon SQS.
50
+ *
51
+ * [^1]: http://en.wikipedia.org/wiki/Unix_time
52
+ * [^2]: http://en.wikipedia.org/wiki/Unix_time
53
+ * [^3]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sse-existing-queue.html
54
+ * [^4]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sqs-sse-queue.html
55
+ *
56
+ * @var list<MessageSystemAttributeName::*>|null
57
+ */
58
+ private $ messageSystemAttributeNames ;
59
+
29
60
/**
30
61
* The name of the message attribute, where *N* is the index.
31
62
*
@@ -62,7 +93,7 @@ final class ReceiveMessageRequest extends Input
62
93
/**
63
94
* The duration (in seconds) for which the call waits for a message to arrive in the queue before returning. If a
64
95
* message is available, the call returns sooner than `WaitTimeSeconds`. If no messages are available and the wait time
65
- * expires, the call returns successfully with an empty list of messages .
96
+ * expires, the call does not return a message list.
66
97
*
67
98
* ! To avoid HTTP errors, ensure that the HTTP response timeout for `ReceiveMessage` requests is longer than the
68
99
* ! `WaitTimeSeconds` parameter. For example, with the Java SDK, you can set HTTP transport settings using the
@@ -86,8 +117,6 @@ final class ReceiveMessageRequest extends Input
86
117
* - You can use `ReceiveRequestAttemptId` only for 5 minutes after a `ReceiveMessage` action.
87
118
* - When you set `FifoQueue`, a caller of the `ReceiveMessage` action can provide a `ReceiveRequestAttemptId`
88
119
* explicitly.
89
- * - If a caller of the `ReceiveMessage` action doesn't provide a `ReceiveRequestAttemptId`, Amazon SQS generates a
90
- * `ReceiveRequestAttemptId`.
91
120
* - It is possible to retry the `ReceiveMessage` action with the same `ReceiveRequestAttemptId` if none of the messages
92
121
* have been modified (deleted or had their visibility changes).
93
122
* - During a visibility timeout, subsequent calls with the same `ReceiveRequestAttemptId` return the same messages and
@@ -125,6 +154,7 @@ final class ReceiveMessageRequest extends Input
125
154
* @param array{
126
155
* QueueUrl?: string,
127
156
* AttributeNames?: null|array<MessageSystemAttributeName::*>,
157
+ * MessageSystemAttributeNames?: null|array<MessageSystemAttributeName::*>,
128
158
* MessageAttributeNames?: null|string[],
129
159
* MaxNumberOfMessages?: null|int,
130
160
* VisibilityTimeout?: null|int,
@@ -137,6 +167,7 @@ public function __construct(array $input = [])
137
167
{
138
168
$ this ->queueUrl = $ input ['QueueUrl ' ] ?? null ;
139
169
$ this ->attributeNames = $ input ['AttributeNames ' ] ?? null ;
170
+ $ this ->messageSystemAttributeNames = $ input ['MessageSystemAttributeNames ' ] ?? null ;
140
171
$ this ->messageAttributeNames = $ input ['MessageAttributeNames ' ] ?? null ;
141
172
$ this ->maxNumberOfMessages = $ input ['MaxNumberOfMessages ' ] ?? null ;
142
173
$ this ->visibilityTimeout = $ input ['VisibilityTimeout ' ] ?? null ;
@@ -149,6 +180,7 @@ public function __construct(array $input = [])
149
180
* @param array{
150
181
* QueueUrl?: string,
151
182
* AttributeNames?: null|array<MessageSystemAttributeName::*>,
183
+ * MessageSystemAttributeNames?: null|array<MessageSystemAttributeName::*>,
152
184
* MessageAttributeNames?: null|string[],
153
185
* MaxNumberOfMessages?: null|int,
154
186
* VisibilityTimeout?: null|int,
@@ -163,10 +195,14 @@ public static function create($input): self
163
195
}
164
196
165
197
/**
198
+ * @deprecated
199
+ *
166
200
* @return list<MessageSystemAttributeName::*>
167
201
*/
168
202
public function getAttributeNames (): array
169
203
{
204
+ @trigger_error (sprintf ('The property "AttributeNames" of "%s" is deprecated by AWS. ' , __CLASS__ ), \E_USER_DEPRECATED );
205
+
170
206
return $ this ->attributeNames ?? [];
171
207
}
172
208
@@ -183,6 +219,14 @@ public function getMessageAttributeNames(): array
183
219
return $ this ->messageAttributeNames ?? [];
184
220
}
185
221
222
+ /**
223
+ * @return list<MessageSystemAttributeName::*>
224
+ */
225
+ public function getMessageSystemAttributeNames (): array
226
+ {
227
+ return $ this ->messageSystemAttributeNames ?? [];
228
+ }
229
+
186
230
public function getQueueUrl (): ?string
187
231
{
188
232
return $ this ->queueUrl ;
@@ -229,10 +273,13 @@ public function request(): Request
229
273
}
230
274
231
275
/**
276
+ * @deprecated
277
+ *
232
278
* @param list<MessageSystemAttributeName::*> $value
233
279
*/
234
280
public function setAttributeNames (array $ value ): self
235
281
{
282
+ @trigger_error (sprintf ('The property "AttributeNames" of "%s" is deprecated by AWS. ' , __CLASS__ ), \E_USER_DEPRECATED );
236
283
$ this ->attributeNames = $ value ;
237
284
238
285
return $ this ;
@@ -255,6 +302,16 @@ public function setMessageAttributeNames(array $value): self
255
302
return $ this ;
256
303
}
257
304
305
+ /**
306
+ * @param list<MessageSystemAttributeName::*> $value
307
+ */
308
+ public function setMessageSystemAttributeNames (array $ value ): self
309
+ {
310
+ $ this ->messageSystemAttributeNames = $ value ;
311
+
312
+ return $ this ;
313
+ }
314
+
258
315
public function setQueueUrl (?string $ value ): self
259
316
{
260
317
$ this ->queueUrl = $ value ;
@@ -291,6 +348,7 @@ private function requestBody(): array
291
348
}
292
349
$ payload ['QueueUrl ' ] = $ v ;
293
350
if (null !== $ v = $ this ->attributeNames ) {
351
+ @trigger_error (sprintf ('The property "AttributeNames" of "%s" is deprecated by AWS. ' , __CLASS__ ), \E_USER_DEPRECATED );
294
352
$ index = -1 ;
295
353
$ payload ['AttributeNames ' ] = [];
296
354
foreach ($ v as $ listValue ) {
@@ -301,6 +359,17 @@ private function requestBody(): array
301
359
$ payload ['AttributeNames ' ][$ index ] = $ listValue ;
302
360
}
303
361
}
362
+ if (null !== $ v = $ this ->messageSystemAttributeNames ) {
363
+ $ index = -1 ;
364
+ $ payload ['MessageSystemAttributeNames ' ] = [];
365
+ foreach ($ v as $ listValue ) {
366
+ ++$ index ;
367
+ if (!MessageSystemAttributeName::exists ($ listValue )) {
368
+ throw new InvalidArgument (sprintf ('Invalid parameter "MessageSystemAttributeNames" for "%s". The value "%s" is not a valid "MessageSystemAttributeName". ' , __CLASS__ , $ listValue ));
369
+ }
370
+ $ payload ['MessageSystemAttributeNames ' ][$ index ] = $ listValue ;
371
+ }
372
+ }
304
373
if (null !== $ v = $ this ->messageAttributeNames ) {
305
374
$ index = -1 ;
306
375
$ payload ['MessageAttributeNames ' ] = [];
0 commit comments