aws-sdk-sqs 1.65.0 → 1.107.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +210 -0
- data/VERSION +1 -1
- data/lib/aws-sdk-sqs/client.rb +406 -212
- data/lib/aws-sdk-sqs/client_api.rb +255 -58
- data/lib/aws-sdk-sqs/customizations.rb +5 -2
- data/lib/aws-sdk-sqs/endpoint_parameters.rb +13 -10
- data/lib/aws-sdk-sqs/endpoint_provider.rb +16 -20
- data/lib/aws-sdk-sqs/endpoints.rb +2 -320
- data/lib/aws-sdk-sqs/errors.rb +251 -0
- data/lib/aws-sdk-sqs/message.rb +3 -3
- data/lib/aws-sdk-sqs/plugins/endpoints.rb +23 -60
- data/lib/aws-sdk-sqs/plugins/md5s.rb +84 -35
- data/lib/aws-sdk-sqs/queue.rb +147 -54
- data/lib/aws-sdk-sqs/queue_poller.rb +1 -1
- data/lib/aws-sdk-sqs/resource.rb +12 -15
- data/lib/aws-sdk-sqs/types.rb +499 -102
- data/lib/aws-sdk-sqs.rb +17 -13
- data/sig/client.rbs +370 -0
- data/sig/errors.rbs +98 -0
- data/sig/message.rbs +73 -0
- data/sig/queue.rbs +164 -0
- data/sig/resource.rbs +111 -0
- data/sig/types.rbs +472 -0
- data/sig/waiters.rbs +13 -0
- metadata +15 -11
|
@@ -6,7 +6,6 @@ module Aws
|
|
|
6
6
|
module SQS
|
|
7
7
|
module Plugins
|
|
8
8
|
class Md5s < Seahorse::Client::Plugin
|
|
9
|
-
|
|
10
9
|
# @api private
|
|
11
10
|
class Handler < Seahorse::Client::Handler
|
|
12
11
|
def call(context)
|
|
@@ -26,16 +25,17 @@ module Aws
|
|
|
26
25
|
'String' => 1,
|
|
27
26
|
'Binary' => 2,
|
|
28
27
|
'Number' => 1
|
|
29
|
-
}
|
|
28
|
+
}.freeze
|
|
30
29
|
|
|
31
|
-
DATA_TYPE = /\A(String|Binary|Number)(\..+)?\z
|
|
30
|
+
DATA_TYPE = /\A(String|Binary|Number)(\..+)?\z/.freeze
|
|
32
31
|
|
|
33
32
|
NORMALIZED_ENCODING = Encoding::UTF_8
|
|
34
33
|
|
|
35
34
|
def validate_send_message(context, response)
|
|
36
35
|
body = context.params[:message_body]
|
|
37
36
|
attributes = context.params[:message_attributes]
|
|
38
|
-
|
|
37
|
+
system_attributes = context.params[:message_system_attributes]
|
|
38
|
+
validate_single_message(body, attributes, system_attributes, response)
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def validate_send_message_batch(context, response)
|
|
@@ -43,63 +43,87 @@ module Aws
|
|
|
43
43
|
id = entry[:id]
|
|
44
44
|
body = entry[:message_body]
|
|
45
45
|
attributes = entry[:message_attributes]
|
|
46
|
+
system_attributes = entry[:message_system_attributes]
|
|
46
47
|
message_response = response.successful.select { |r| r.id == id }[0]
|
|
47
48
|
unless message_response.nil?
|
|
48
|
-
validate_single_message(body, attributes, message_response)
|
|
49
|
+
validate_single_message(body, attributes, system_attributes, message_response)
|
|
49
50
|
end
|
|
50
51
|
end
|
|
51
52
|
end
|
|
52
53
|
|
|
53
|
-
def validate_single_message(body, attributes, response)
|
|
54
|
+
def validate_single_message(body, attributes, system_attributes, response)
|
|
54
55
|
validate_body(body, response)
|
|
55
56
|
unless attributes.nil? || attributes.empty?
|
|
56
57
|
validate_attributes(attributes, response)
|
|
57
58
|
end
|
|
59
|
+
unless system_attributes.nil? || system_attributes.empty?
|
|
60
|
+
validate_system_attributes(system_attributes, response)
|
|
61
|
+
end
|
|
58
62
|
end
|
|
59
63
|
|
|
60
64
|
def validate_body(body, response)
|
|
61
65
|
calculated_md5 = md5_of_message_body(body)
|
|
62
66
|
returned_md5 = response.md5_of_message_body
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
return unless calculated_md5 != returned_md5
|
|
68
|
+
|
|
69
|
+
error_message = mismatch_error_message(
|
|
70
|
+
'message body',
|
|
71
|
+
calculated_md5,
|
|
72
|
+
returned_md5,
|
|
73
|
+
response
|
|
74
|
+
)
|
|
75
|
+
raise Aws::Errors::ChecksumError, error_message
|
|
71
76
|
end
|
|
72
77
|
|
|
73
78
|
def validate_attributes(attributes, response)
|
|
74
79
|
calculated_md5 = md5_of_message_attributes(attributes)
|
|
75
80
|
returned_md5 = response.md5_of_message_attributes
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
return unless returned_md5 != calculated_md5
|
|
82
|
+
|
|
83
|
+
error_message = mismatch_error_message(
|
|
84
|
+
'message attributes',
|
|
85
|
+
calculated_md5,
|
|
86
|
+
returned_md5,
|
|
87
|
+
response
|
|
88
|
+
)
|
|
89
|
+
raise Aws::Errors::ChecksumError, error_message
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def validate_system_attributes(system_attributes, response)
|
|
93
|
+
calculated_md5 = md5_of_message_system_attributes(system_attributes)
|
|
94
|
+
returned_md5 = response.md5_of_message_system_attributes
|
|
95
|
+
return unless returned_md5 != calculated_md5
|
|
96
|
+
|
|
97
|
+
error_message = mismatch_error_message(
|
|
98
|
+
'message system attributes',
|
|
99
|
+
calculated_md5,
|
|
100
|
+
returned_md5,
|
|
101
|
+
response
|
|
102
|
+
)
|
|
103
|
+
raise Aws::Errors::ChecksumError, error_message
|
|
84
104
|
end
|
|
85
105
|
|
|
86
106
|
def md5_of_message_body(message_body)
|
|
87
107
|
OpenSSL::Digest::MD5.hexdigest(message_body)
|
|
88
108
|
end
|
|
89
109
|
|
|
110
|
+
# MD5 of Message Attributes and System Attributes are effectively
|
|
111
|
+
# the same calculation. However, keeping these as two methods because
|
|
112
|
+
# they are modeled as two different shapes.
|
|
113
|
+
###
|
|
90
114
|
def md5_of_message_attributes(message_attributes)
|
|
91
|
-
encoded = {
|
|
115
|
+
encoded = {}
|
|
92
116
|
message_attributes.each do |name, attribute|
|
|
93
117
|
name = name.to_s
|
|
94
118
|
encoded[name] = String.new
|
|
95
119
|
data_type_without_label = DATA_TYPE.match(attribute[:data_type])[1]
|
|
96
120
|
encoded[name] << encode_length_and_bytes(name) <<
|
|
97
|
-
|
|
98
|
-
|
|
121
|
+
encode_length_and_bytes(attribute[:data_type]) <<
|
|
122
|
+
[TRANSPORT_TYPE_ENCODINGS[data_type_without_label]].pack('C')
|
|
99
123
|
|
|
100
|
-
if attribute[:string_value]
|
|
124
|
+
if !attribute[:string_value].nil?
|
|
101
125
|
encoded[name] << encode_length_and_string(attribute[:string_value])
|
|
102
|
-
elsif attribute[:binary_value]
|
|
126
|
+
elsif !attribute[:binary_value].nil?
|
|
103
127
|
encoded[name] << encode_length_and_bytes(attribute[:binary_value])
|
|
104
128
|
end
|
|
105
129
|
end
|
|
@@ -110,6 +134,30 @@ module Aws
|
|
|
110
134
|
OpenSSL::Digest::MD5.hexdigest(buffer)
|
|
111
135
|
end
|
|
112
136
|
|
|
137
|
+
def md5_of_message_system_attributes(message_system_attributes)
|
|
138
|
+
encoded = {}
|
|
139
|
+
message_system_attributes.each do |name, attribute|
|
|
140
|
+
name = name.to_s
|
|
141
|
+
encoded[name] = String.new
|
|
142
|
+
data_type_without_label = DATA_TYPE.match(attribute[:data_type])[1]
|
|
143
|
+
encoded[name] << encode_length_and_bytes(name) <<
|
|
144
|
+
encode_length_and_bytes(attribute[:data_type]) <<
|
|
145
|
+
[TRANSPORT_TYPE_ENCODINGS[data_type_without_label]].pack('C')
|
|
146
|
+
|
|
147
|
+
if !attribute[:string_value].nil?
|
|
148
|
+
encoded[name] << encode_length_and_string(attribute[:string_value])
|
|
149
|
+
elsif !attribute[:binary_value].nil?
|
|
150
|
+
encoded[name] << encode_length_and_bytes(attribute[:binary_value])
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
buffer = encoded.keys.sort.reduce(String.new) do |string, name|
|
|
155
|
+
string << encoded[name]
|
|
156
|
+
end
|
|
157
|
+
OpenSSL::Digest::MD5.hexdigest(buffer)
|
|
158
|
+
end
|
|
159
|
+
###
|
|
160
|
+
|
|
113
161
|
def encode_length_and_string(string)
|
|
114
162
|
string = String.new(string)
|
|
115
163
|
string.encode!(NORMALIZED_ENCODING)
|
|
@@ -117,7 +165,7 @@ module Aws
|
|
|
117
165
|
end
|
|
118
166
|
|
|
119
167
|
def encode_length_and_bytes(bytes)
|
|
120
|
-
[bytes.bytesize, bytes].pack('L>a*'
|
|
168
|
+
[bytes.bytesize, bytes].pack('L>a*')
|
|
121
169
|
end
|
|
122
170
|
|
|
123
171
|
def mismatch_error_message(section, local_md5, returned_md5, response)
|
|
@@ -154,13 +202,14 @@ not match.
|
|
|
154
202
|
end
|
|
155
203
|
|
|
156
204
|
def add_handlers(handlers, config)
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
205
|
+
return unless config.verify_checksums
|
|
206
|
+
|
|
207
|
+
handlers.add(
|
|
208
|
+
Handler,
|
|
209
|
+
priority: 10,
|
|
210
|
+
step: :validate,
|
|
211
|
+
operations: %i[send_message send_message_batch]
|
|
212
|
+
)
|
|
164
213
|
end
|
|
165
214
|
end
|
|
166
215
|
end
|
data/lib/aws-sdk-sqs/queue.rb
CHANGED
|
@@ -54,7 +54,7 @@ module Aws::SQS
|
|
|
54
54
|
#
|
|
55
55
|
# @return [self]
|
|
56
56
|
def load
|
|
57
|
-
resp = Aws::Plugins::UserAgent.
|
|
57
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
|
58
58
|
@client.get_queue_attributes(
|
|
59
59
|
queue_url: @url,
|
|
60
60
|
attribute_names: ["All"]
|
|
@@ -125,7 +125,7 @@ module Aws::SQS
|
|
|
125
125
|
# @return [EmptyStructure]
|
|
126
126
|
def add_permission(options = {})
|
|
127
127
|
options = options.merge(queue_url: @url)
|
|
128
|
-
resp = Aws::Plugins::UserAgent.
|
|
128
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
|
129
129
|
@client.add_permission(options)
|
|
130
130
|
end
|
|
131
131
|
resp.data
|
|
@@ -149,7 +149,7 @@ module Aws::SQS
|
|
|
149
149
|
# @return [Types::ChangeMessageVisibilityBatchResult]
|
|
150
150
|
def change_message_visibility_batch(options = {})
|
|
151
151
|
options = options.merge(queue_url: @url)
|
|
152
|
-
resp = Aws::Plugins::UserAgent.
|
|
152
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
|
153
153
|
@client.change_message_visibility_batch(options)
|
|
154
154
|
end
|
|
155
155
|
resp.data
|
|
@@ -162,7 +162,7 @@ module Aws::SQS
|
|
|
162
162
|
# @return [EmptyStructure]
|
|
163
163
|
def delete(options = {})
|
|
164
164
|
options = options.merge(queue_url: @url)
|
|
165
|
-
resp = Aws::Plugins::UserAgent.
|
|
165
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
|
166
166
|
@client.delete_queue(options)
|
|
167
167
|
end
|
|
168
168
|
resp.data
|
|
@@ -184,7 +184,7 @@ module Aws::SQS
|
|
|
184
184
|
# @return [Types::DeleteMessageBatchResult]
|
|
185
185
|
def delete_messages(options = {})
|
|
186
186
|
options = options.merge(queue_url: @url)
|
|
187
|
-
resp = Aws::Plugins::UserAgent.
|
|
187
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
|
188
188
|
@client.delete_message_batch(options)
|
|
189
189
|
end
|
|
190
190
|
resp.data
|
|
@@ -197,7 +197,7 @@ module Aws::SQS
|
|
|
197
197
|
# @return [EmptyStructure]
|
|
198
198
|
def purge(options = {})
|
|
199
199
|
options = options.merge(queue_url: @url)
|
|
200
|
-
resp = Aws::Plugins::UserAgent.
|
|
200
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
|
201
201
|
@client.purge_queue(options)
|
|
202
202
|
end
|
|
203
203
|
resp.data
|
|
@@ -207,6 +207,7 @@ module Aws::SQS
|
|
|
207
207
|
#
|
|
208
208
|
# message = queue.receive_messages({
|
|
209
209
|
# attribute_names: ["All"], # accepts All, Policy, VisibilityTimeout, MaximumMessageSize, MessageRetentionPeriod, ApproximateNumberOfMessages, ApproximateNumberOfMessagesNotVisible, CreatedTimestamp, LastModifiedTimestamp, QueueArn, ApproximateNumberOfMessagesDelayed, DelaySeconds, ReceiveMessageWaitTimeSeconds, RedrivePolicy, FifoQueue, ContentBasedDeduplication, KmsMasterKeyId, KmsDataKeyReusePeriodSeconds, DeduplicationScope, FifoThroughputLimit, RedriveAllowPolicy, SqsManagedSseEnabled
|
|
210
|
+
# message_system_attribute_names: ["All"], # accepts All, SenderId, SentTimestamp, ApproximateReceiveCount, ApproximateFirstReceiveTimestamp, SequenceNumber, MessageDeduplicationId, MessageGroupId, AWSTraceHeader, DeadLetterQueueSourceArn
|
|
210
211
|
# message_attribute_names: ["MessageAttributeName"],
|
|
211
212
|
# max_number_of_messages: 1,
|
|
212
213
|
# visibility_timeout: 1,
|
|
@@ -215,6 +216,10 @@ module Aws::SQS
|
|
|
215
216
|
# })
|
|
216
217
|
# @param [Hash] options ({})
|
|
217
218
|
# @option options [Array<String>] :attribute_names
|
|
219
|
+
# This parameter has been discontinued but will be supported for
|
|
220
|
+
# backward compatibility. To provide attribute names, you are encouraged
|
|
221
|
+
# to use `MessageSystemAttributeNames`.
|
|
222
|
+
#
|
|
218
223
|
# A list of attributes that need to be returned along with each message.
|
|
219
224
|
# These attributes include:
|
|
220
225
|
#
|
|
@@ -235,7 +240,47 @@ module Aws::SQS
|
|
|
235
240
|
#
|
|
236
241
|
# * For an IAM role, returns the IAM role ID, for example
|
|
237
242
|
# `ABCDE1F2GH3I4JK5LMNOP:i-a123b456`.
|
|
243
|
+
# * `SentTimestamp` – Returns the time the message was sent to the queue
|
|
244
|
+
# ([epoch time][1] in milliseconds).
|
|
245
|
+
#
|
|
246
|
+
# * `SqsManagedSseEnabled` – Enables server-side queue encryption using
|
|
247
|
+
# SQS owned encryption keys. Only one server-side encryption option is
|
|
248
|
+
# supported per queue (for example, [SSE-KMS][2] or [SSE-SQS][3]).
|
|
249
|
+
#
|
|
250
|
+
# * `MessageDeduplicationId` – Returns the value provided by the
|
|
251
|
+
# producer that calls the ` SendMessage ` action.
|
|
252
|
+
#
|
|
253
|
+
# * `MessageGroupId` – Returns the value provided by the producer that
|
|
254
|
+
# calls the ` SendMessage ` action.
|
|
255
|
+
#
|
|
256
|
+
# * `SequenceNumber` – Returns the value provided by Amazon SQS.
|
|
257
|
+
#
|
|
258
|
+
#
|
|
259
|
+
#
|
|
260
|
+
# [1]: http://en.wikipedia.org/wiki/Unix_time
|
|
261
|
+
# [2]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sse-existing-queue.html
|
|
262
|
+
# [3]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sqs-sse-queue.html
|
|
263
|
+
# @option options [Array<String>] :message_system_attribute_names
|
|
264
|
+
# A list of attributes that need to be returned along with each message.
|
|
265
|
+
# These attributes include:
|
|
266
|
+
#
|
|
267
|
+
# * `All` – Returns all values.
|
|
268
|
+
#
|
|
269
|
+
# * `ApproximateFirstReceiveTimestamp` – Returns the time the message
|
|
270
|
+
# was first received from the queue ([epoch time][1] in milliseconds).
|
|
271
|
+
#
|
|
272
|
+
# * `ApproximateReceiveCount` – Returns the number of times a message
|
|
273
|
+
# has been received across all queues but not deleted.
|
|
238
274
|
#
|
|
275
|
+
# * `AWSTraceHeader` – Returns the X-Ray trace header string.
|
|
276
|
+
#
|
|
277
|
+
# * `SenderId`
|
|
278
|
+
#
|
|
279
|
+
# * For a user, returns the user ID, for example
|
|
280
|
+
# `ABCDEFGHI1JKLMNOPQ23R`.
|
|
281
|
+
#
|
|
282
|
+
# * For an IAM role, returns the IAM role ID, for example
|
|
283
|
+
# `ABCDE1F2GH3I4JK5LMNOP:i-a123b456`.
|
|
239
284
|
# * `SentTimestamp` – Returns the time the message was sent to the queue
|
|
240
285
|
# ([epoch time][1] in milliseconds).
|
|
241
286
|
#
|
|
@@ -247,8 +292,7 @@ module Aws::SQS
|
|
|
247
292
|
# producer that calls the ` SendMessage ` action.
|
|
248
293
|
#
|
|
249
294
|
# * `MessageGroupId` – Returns the value provided by the producer that
|
|
250
|
-
# calls the ` SendMessage ` action.
|
|
251
|
-
# `MessageGroupId` are returned in sequence.
|
|
295
|
+
# calls the ` SendMessage ` action.
|
|
252
296
|
#
|
|
253
297
|
# * `SequenceNumber` – Returns the value provided by Amazon SQS.
|
|
254
298
|
#
|
|
@@ -285,13 +329,46 @@ module Aws::SQS
|
|
|
285
329
|
# @option options [Integer] :visibility_timeout
|
|
286
330
|
# The duration (in seconds) that the received messages are hidden from
|
|
287
331
|
# subsequent retrieve requests after being retrieved by a
|
|
288
|
-
# `ReceiveMessage` request.
|
|
332
|
+
# `ReceiveMessage` request. If not specified, the default visibility
|
|
333
|
+
# timeout for the queue is used, which is 30 seconds.
|
|
334
|
+
#
|
|
335
|
+
# Understanding `VisibilityTimeout`:
|
|
336
|
+
#
|
|
337
|
+
# * When a message is received from a queue, it becomes temporarily
|
|
338
|
+
# invisible to other consumers for the duration of the visibility
|
|
339
|
+
# timeout. This prevents multiple consumers from processing the same
|
|
340
|
+
# message simultaneously. If the message is not deleted or its
|
|
341
|
+
# visibility timeout is not extended before the timeout expires, it
|
|
342
|
+
# becomes visible again and can be retrieved by other consumers.
|
|
343
|
+
#
|
|
344
|
+
# * Setting an appropriate visibility timeout is crucial. If it's too
|
|
345
|
+
# short, the message might become visible again before processing is
|
|
346
|
+
# complete, leading to duplicate processing. If it's too long, it
|
|
347
|
+
# delays the reprocessing of messages if the initial processing fails.
|
|
348
|
+
#
|
|
349
|
+
# * You can adjust the visibility timeout using the
|
|
350
|
+
# `--visibility-timeout` parameter in the `receive-message` command to
|
|
351
|
+
# match the processing time required by your application.
|
|
352
|
+
#
|
|
353
|
+
# * A message that isn't deleted or a message whose visibility isn't
|
|
354
|
+
# extended before the visibility timeout expires counts as a failed
|
|
355
|
+
# receive. Depending on the configuration of the queue, the message
|
|
356
|
+
# might be sent to the dead-letter queue.
|
|
357
|
+
#
|
|
358
|
+
# For more information, see [Visibility Timeout][1] in the *Amazon SQS
|
|
359
|
+
# Developer Guide*.
|
|
360
|
+
#
|
|
361
|
+
#
|
|
362
|
+
#
|
|
363
|
+
# [1]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
|
|
289
364
|
# @option options [Integer] :wait_time_seconds
|
|
290
365
|
# The duration (in seconds) for which the call waits for a message to
|
|
291
366
|
# arrive in the queue before returning. If a message is available, the
|
|
292
367
|
# call returns sooner than `WaitTimeSeconds`. If no messages are
|
|
293
|
-
# available and the wait time expires, the call
|
|
294
|
-
#
|
|
368
|
+
# available and the wait time expires, the call does not return a
|
|
369
|
+
# message list. If you are using the Java SDK, it returns a
|
|
370
|
+
# `ReceiveMessageResponse` object, which has a empty list instead of a
|
|
371
|
+
# Null object.
|
|
295
372
|
#
|
|
296
373
|
# To avoid HTTP errors, ensure that the HTTP response timeout for
|
|
297
374
|
# `ReceiveMessage` requests is longer than the `WaitTimeSeconds`
|
|
@@ -319,10 +396,6 @@ module Aws::SQS
|
|
|
319
396
|
# * When you set `FifoQueue`, a caller of the `ReceiveMessage` action
|
|
320
397
|
# can provide a `ReceiveRequestAttemptId` explicitly.
|
|
321
398
|
#
|
|
322
|
-
# * If a caller of the `ReceiveMessage` action doesn't provide a
|
|
323
|
-
# `ReceiveRequestAttemptId`, Amazon SQS generates a
|
|
324
|
-
# `ReceiveRequestAttemptId`.
|
|
325
|
-
#
|
|
326
399
|
# * It is possible to retry the `ReceiveMessage` action with the same
|
|
327
400
|
# `ReceiveRequestAttemptId` if none of the messages have been modified
|
|
328
401
|
# (deleted or had their visibility changes).
|
|
@@ -347,7 +420,8 @@ module Aws::SQS
|
|
|
347
420
|
# * While messages with a particular `MessageGroupId` are invisible, no
|
|
348
421
|
# more messages belonging to the same `MessageGroupId` are returned
|
|
349
422
|
# until the visibility timeout expires. You can still receive messages
|
|
350
|
-
# with another `MessageGroupId` as long as
|
|
423
|
+
# with another `MessageGroupId` from your FIFO queue as long as they
|
|
424
|
+
# are visible.
|
|
351
425
|
#
|
|
352
426
|
# * If a caller of `ReceiveMessage` can't track the
|
|
353
427
|
# `ReceiveRequestAttemptId`, no retries work until the original
|
|
@@ -356,7 +430,7 @@ module Aws::SQS
|
|
|
356
430
|
#
|
|
357
431
|
# The maximum length of `ReceiveRequestAttemptId` is 128 characters.
|
|
358
432
|
# `ReceiveRequestAttemptId` can contain alphanumeric characters (`a-z`,
|
|
359
|
-
# `A-Z`, `0-9`) and punctuation (`` !"#$%&'()*+,-./:;<=>?@[\]^_
|
|
433
|
+
# `A-Z`, `0-9`) and punctuation (`` !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
|
|
360
434
|
# ``).
|
|
361
435
|
#
|
|
362
436
|
# For best practices of using `ReceiveRequestAttemptId`, see [Using the
|
|
@@ -371,7 +445,7 @@ module Aws::SQS
|
|
|
371
445
|
def receive_messages(options = {})
|
|
372
446
|
batch = []
|
|
373
447
|
options = options.merge(queue_url: @url)
|
|
374
|
-
resp = Aws::Plugins::UserAgent.
|
|
448
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
|
375
449
|
@client.receive_message(options)
|
|
376
450
|
end
|
|
377
451
|
resp.data.messages.each do |m|
|
|
@@ -397,7 +471,7 @@ module Aws::SQS
|
|
|
397
471
|
# @return [EmptyStructure]
|
|
398
472
|
def remove_permission(options = {})
|
|
399
473
|
options = options.merge(queue_url: @url)
|
|
400
|
-
resp = Aws::Plugins::UserAgent.
|
|
474
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
|
401
475
|
@client.remove_permission(options)
|
|
402
476
|
end
|
|
403
477
|
resp.data
|
|
@@ -432,16 +506,19 @@ module Aws::SQS
|
|
|
432
506
|
# @param [Hash] options ({})
|
|
433
507
|
# @option options [required, String] :message_body
|
|
434
508
|
# The message to send. The minimum size is one character. The maximum
|
|
435
|
-
# size is
|
|
509
|
+
# size is 1 MiB or 1,048,576 bytes
|
|
436
510
|
#
|
|
437
511
|
# A message can include only XML, JSON, and unformatted text. The
|
|
438
|
-
# following Unicode characters are allowed
|
|
512
|
+
# following Unicode characters are allowed. For more information, see
|
|
513
|
+
# the [W3C specification for characters][1].
|
|
439
514
|
#
|
|
440
515
|
# `#x9` \| `#xA` \| `#xD` \| `#x20` to `#xD7FF` \| `#xE000` to `#xFFFD`
|
|
441
516
|
# \| `#x10000` to `#x10FFFF`
|
|
442
517
|
#
|
|
443
|
-
#
|
|
444
|
-
#
|
|
518
|
+
# If a message contains characters outside the allowed set, Amazon SQS
|
|
519
|
+
# rejects the message and returns an InvalidMessageContents error.
|
|
520
|
+
# Ensure that your message body includes only valid characters to avoid
|
|
521
|
+
# this exception.
|
|
445
522
|
#
|
|
446
523
|
#
|
|
447
524
|
#
|
|
@@ -500,7 +577,6 @@ module Aws::SQS
|
|
|
500
577
|
#
|
|
501
578
|
# * If the queue has `ContentBasedDeduplication` set, your
|
|
502
579
|
# `MessageDeduplicationId` overrides the generated one.
|
|
503
|
-
#
|
|
504
580
|
# * When `ContentBasedDeduplication` is in effect, messages with
|
|
505
581
|
# identical content sent within the deduplication interval are treated
|
|
506
582
|
# as duplicates and only one copy of the message is delivered.
|
|
@@ -525,7 +601,7 @@ module Aws::SQS
|
|
|
525
601
|
#
|
|
526
602
|
# The maximum length of `MessageDeduplicationId` is 128 characters.
|
|
527
603
|
# `MessageDeduplicationId` can contain alphanumeric characters (`a-z`,
|
|
528
|
-
# `A-Z`, `0-9`) and punctuation (`` !"#$%&'()*+,-./:;<=>?@[\]^_
|
|
604
|
+
# `A-Z`, `0-9`) and punctuation (`` !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
|
|
529
605
|
# ``).
|
|
530
606
|
#
|
|
531
607
|
# For best practices of using `MessageDeduplicationId`, see [Using the
|
|
@@ -537,41 +613,61 @@ module Aws::SQS
|
|
|
537
613
|
# [1]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues-exactly-once-processing.html
|
|
538
614
|
# [2]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/using-messagededuplicationid-property.html
|
|
539
615
|
# @option options [String] :message_group_id
|
|
540
|
-
#
|
|
541
|
-
#
|
|
542
|
-
#
|
|
543
|
-
#
|
|
544
|
-
#
|
|
545
|
-
# processed
|
|
546
|
-
#
|
|
547
|
-
#
|
|
548
|
-
#
|
|
549
|
-
#
|
|
550
|
-
#
|
|
551
|
-
#
|
|
552
|
-
#
|
|
553
|
-
#
|
|
554
|
-
#
|
|
616
|
+
# `MessageGroupId` is an attribute used in Amazon SQS FIFO
|
|
617
|
+
# (First-In-First-Out) and standard queues. In FIFO queues,
|
|
618
|
+
# `MessageGroupId` organizes messages into distinct groups. Messages
|
|
619
|
+
# within the same message group are always processed one at a time, in
|
|
620
|
+
# strict order, ensuring that no two messages from the same group are
|
|
621
|
+
# processed simultaneously. In standard queues, using `MessageGroupId`
|
|
622
|
+
# enables fair queues. It is used to identify the tenant a message
|
|
623
|
+
# belongs to, helping maintain consistent message dwell time across all
|
|
624
|
+
# tenants during noisy neighbor events. Unlike FIFO queues, messages
|
|
625
|
+
# with the same `MessageGroupId` can be processed in parallel,
|
|
626
|
+
# maintaining the high throughput of standard queues.
|
|
627
|
+
#
|
|
628
|
+
# * **FIFO queues:** `MessageGroupId` acts as the tag that specifies
|
|
629
|
+
# that a message belongs to a specific message group. Messages that
|
|
630
|
+
# belong to the same message group are processed in a FIFO manner
|
|
631
|
+
# (however, messages in different message groups might be processed
|
|
632
|
+
# out of order). To interleave multiple ordered streams within a
|
|
633
|
+
# single queue, use `MessageGroupId` values (for example, session data
|
|
634
|
+
# for multiple users). In this scenario, multiple consumers can
|
|
635
|
+
# process the queue, but the session data of each user is processed in
|
|
636
|
+
# a FIFO fashion.
|
|
637
|
+
#
|
|
638
|
+
# If you do not provide a `MessageGroupId` when sending a message to a
|
|
639
|
+
# FIFO queue, the action fails.
|
|
640
|
+
#
|
|
641
|
+
# `ReceiveMessage` might return messages with multiple
|
|
555
642
|
# `MessageGroupId` values. For each `MessageGroupId`, the messages are
|
|
556
|
-
# sorted by time sent.
|
|
643
|
+
# sorted by time sent.
|
|
644
|
+
#
|
|
645
|
+
# * **Standard queues:**Use `MessageGroupId` in standard queues to
|
|
646
|
+
# enable fair queues. The `MessageGroupId` identifies the tenant a
|
|
647
|
+
# message belongs to. A tenant can be any entity that shares a queue
|
|
648
|
+
# with others, such as your customer, a client application, or a
|
|
649
|
+
# request type. When one tenant sends a disproportionately large
|
|
650
|
+
# volume of messages or has messages that require longer processing
|
|
651
|
+
# time, fair queues ensure other tenants' messages maintain low dwell
|
|
652
|
+
# time. This preserves quality of service for all tenants while
|
|
653
|
+
# maintaining the scalability and throughput of standard queues. We
|
|
654
|
+
# recommend that you include a `MessageGroupId` in all messages when
|
|
655
|
+
# using fair queues.
|
|
557
656
|
#
|
|
558
657
|
# The length of `MessageGroupId` is 128 characters. Valid values:
|
|
559
658
|
# alphanumeric characters and punctuation ``
|
|
560
|
-
# (!"#$%&'()*+,-./:;<=>?@[\]^_
|
|
659
|
+
# (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~) ``.
|
|
561
660
|
#
|
|
562
661
|
# For best practices of using `MessageGroupId`, see [Using the
|
|
563
662
|
# MessageGroupId Property][1] in the *Amazon SQS Developer Guide*.
|
|
564
663
|
#
|
|
565
|
-
# `MessageGroupId` is required for FIFO queues. You can't use it for
|
|
566
|
-
# Standard queues.
|
|
567
|
-
#
|
|
568
664
|
#
|
|
569
665
|
#
|
|
570
666
|
# [1]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/using-messagegroupid-property.html
|
|
571
667
|
# @return [Types::SendMessageResult]
|
|
572
668
|
def send_message(options = {})
|
|
573
669
|
options = options.merge(queue_url: @url)
|
|
574
|
-
resp = Aws::Plugins::UserAgent.
|
|
670
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
|
575
671
|
@client.send_message(options)
|
|
576
672
|
end
|
|
577
673
|
resp.data
|
|
@@ -614,7 +710,7 @@ module Aws::SQS
|
|
|
614
710
|
# @return [Types::SendMessageBatchResult]
|
|
615
711
|
def send_messages(options = {})
|
|
616
712
|
options = options.merge(queue_url: @url)
|
|
617
|
-
resp = Aws::Plugins::UserAgent.
|
|
713
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
|
618
714
|
@client.send_message_batch(options)
|
|
619
715
|
end
|
|
620
716
|
resp.data
|
|
@@ -640,8 +736,8 @@ module Aws::SQS
|
|
|
640
736
|
#
|
|
641
737
|
# * `MaximumMessageSize` – The limit of how many bytes a message can
|
|
642
738
|
# contain before Amazon SQS rejects it. Valid values: An integer from
|
|
643
|
-
# 1,024 bytes (1 KiB) up to
|
|
644
|
-
# (
|
|
739
|
+
# 1,024 bytes (1 KiB) up to 1,048,576 bytes (1 MiB). Default:
|
|
740
|
+
# 1,048,576 bytes (1 MiB).
|
|
645
741
|
#
|
|
646
742
|
# * `MessageRetentionPeriod` – The length of time, in seconds, for which
|
|
647
743
|
# Amazon SQS retains a message. Valid values: An integer representing
|
|
@@ -683,7 +779,6 @@ module Aws::SQS
|
|
|
683
779
|
# Default: 10. When the `ReceiveCount` for a message exceeds the
|
|
684
780
|
# `maxReceiveCount` for a queue, Amazon SQS moves the message to the
|
|
685
781
|
# dead-letter-queue.
|
|
686
|
-
#
|
|
687
782
|
# * `RedriveAllowPolicy` – The string that includes the parameters for
|
|
688
783
|
# the permissions for the dead-letter queue redrive permission and
|
|
689
784
|
# which source queues can specify dead-letter queues as a JSON object.
|
|
@@ -702,7 +797,6 @@ module Aws::SQS
|
|
|
702
797
|
#
|
|
703
798
|
# * `byQueue` – Only queues specified by the `sourceQueueArns`
|
|
704
799
|
# parameter can specify this queue as the dead-letter queue.
|
|
705
|
-
#
|
|
706
800
|
# * `sourceQueueArns` – The Amazon Resource Names (ARN)s of the source
|
|
707
801
|
# queues that can specify this queue as the dead-letter queue and
|
|
708
802
|
# redrive messages. You can specify this parameter only when the
|
|
@@ -762,7 +856,6 @@ module Aws::SQS
|
|
|
762
856
|
#
|
|
763
857
|
# * If the queue has `ContentBasedDeduplication` set, your
|
|
764
858
|
# `MessageDeduplicationId` overrides the generated one.
|
|
765
|
-
#
|
|
766
859
|
# * When `ContentBasedDeduplication` is in effect, messages with
|
|
767
860
|
# identical content sent within the deduplication interval are
|
|
768
861
|
# treated as duplicates and only one copy of the message is
|
|
@@ -819,7 +912,7 @@ module Aws::SQS
|
|
|
819
912
|
# @return [EmptyStructure]
|
|
820
913
|
def set_attributes(options = {})
|
|
821
914
|
options = options.merge(queue_url: @url)
|
|
822
|
-
resp = Aws::Plugins::UserAgent.
|
|
915
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
|
823
916
|
@client.set_queue_attributes(options)
|
|
824
917
|
end
|
|
825
918
|
resp.data
|
|
@@ -835,7 +928,7 @@ module Aws::SQS
|
|
|
835
928
|
def dead_letter_source_queues(options = {})
|
|
836
929
|
batches = Enumerator.new do |y|
|
|
837
930
|
options = options.merge(queue_url: @url)
|
|
838
|
-
resp = Aws::Plugins::UserAgent.
|
|
931
|
+
resp = Aws::Plugins::UserAgent.metric('RESOURCE_MODEL') do
|
|
839
932
|
@client.list_dead_letter_source_queues(options)
|
|
840
933
|
end
|
|
841
934
|
resp.each_page do |page|
|
|
@@ -134,7 +134,7 @@ module Aws
|
|
|
134
134
|
# ### `:idle_timeout` Option
|
|
135
135
|
#
|
|
136
136
|
# This is a configurable, maximum number of seconds to wait for a
|
|
137
|
-
# new message before the polling loop
|
|
137
|
+
# new message before the polling loop exits. By default, there is
|
|
138
138
|
# no idle timeout.
|
|
139
139
|
#
|
|
140
140
|
# # stops polling after a minute of no received messages
|