aws-sdk-sqs 1.24.0 → 1.69.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +450 -0
- data/LICENSE.txt +202 -0
- data/VERSION +1 -0
- data/lib/aws-sdk-sqs/client.rb +861 -340
- data/lib/aws-sdk-sqs/client_api.rb +340 -52
- data/lib/aws-sdk-sqs/customizations.rb +2 -0
- data/lib/aws-sdk-sqs/endpoint_parameters.rb +66 -0
- data/lib/aws-sdk-sqs/endpoint_provider.rb +57 -0
- data/lib/aws-sdk-sqs/endpoints.rb +338 -0
- data/lib/aws-sdk-sqs/errors.rb +265 -1
- data/lib/aws-sdk-sqs/message.rb +18 -9
- data/lib/aws-sdk-sqs/plugins/endpoints.rb +115 -0
- data/lib/aws-sdk-sqs/plugins/md5s.rb +6 -6
- data/lib/aws-sdk-sqs/plugins/queue_urls.rb +22 -18
- data/lib/aws-sdk-sqs/queue.rb +224 -112
- data/lib/aws-sdk-sqs/queue_poller.rb +74 -36
- data/lib/aws-sdk-sqs/resource.rb +165 -81
- data/lib/aws-sdk-sqs/types.rb +1035 -567
- data/lib/aws-sdk-sqs.rb +10 -3
- metadata +16 -9
@@ -1,8 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'set'
|
2
4
|
|
3
5
|
module Aws
|
4
6
|
module SQS
|
5
|
-
|
6
7
|
# A utility class for long polling messages in a loop. **Messages are
|
7
8
|
# automatically deleted from the queue at the end of the given block.**
|
8
9
|
#
|
@@ -179,6 +180,16 @@ module Aws
|
|
179
180
|
# end
|
180
181
|
# ```
|
181
182
|
#
|
183
|
+
# * Configure an {#after_empty_receive} callback.
|
184
|
+
#
|
185
|
+
# ```
|
186
|
+
# poller.after_empty_receive do |stats|
|
187
|
+
# logger.info("requests: #{stats.request_count}")
|
188
|
+
# logger.info("messages: #{stats.received_message_count}")
|
189
|
+
# logger.info("last-timestamp: #{stats.last_message_received_at}")
|
190
|
+
# end
|
191
|
+
# ```
|
192
|
+
#
|
182
193
|
# * Accept a 2nd argument in the poll block, for example:
|
183
194
|
#
|
184
195
|
# ```
|
@@ -201,7 +212,6 @@ module Aws
|
|
201
212
|
# ```
|
202
213
|
#
|
203
214
|
class QueuePoller
|
204
|
-
|
205
215
|
# @param [String] queue_url
|
206
216
|
# @option options [Client] :client
|
207
217
|
# @option (see #poll)
|
@@ -256,6 +266,21 @@ module Aws
|
|
256
266
|
@default_config = @default_config.with(before_request: block) if block_given?
|
257
267
|
end
|
258
268
|
|
269
|
+
# Registers a callback that is invoked when the poll requests returns with no messages.
|
270
|
+
# This callback is invoked after the idle timeout is checked.
|
271
|
+
#
|
272
|
+
# poller.after_empty_receive do |stats|
|
273
|
+
# # Handle empty receive
|
274
|
+
# end
|
275
|
+
#
|
276
|
+
# @yieldparam [PollerStats] stats An object that tracks a few
|
277
|
+
# client-side statistics about the queue polling.
|
278
|
+
#
|
279
|
+
# @return [void]
|
280
|
+
def after_empty_receive(&block)
|
281
|
+
@default_config = @default_config.with(after_empty_receive: block) if block_given?
|
282
|
+
end
|
283
|
+
|
259
284
|
# Polls the queue, yielded a message, or an array of messages.
|
260
285
|
# Messages are automatically deleted from the queue at the
|
261
286
|
# end of the given block. See the class documentation on
|
@@ -288,7 +313,7 @@ module Aws
|
|
288
313
|
# @option options [Integer] :visibility_timeout (nil)
|
289
314
|
# The number of seconds you have to process a message before
|
290
315
|
# it is put back into the queue and can be received again.
|
291
|
-
# By default, the queue's
|
316
|
+
# By default, the queue's visibility timeout is not set.
|
292
317
|
#
|
293
318
|
# @option options [Array<String>] :attribute_names ([])
|
294
319
|
# The list of attributes that need to be returned along with each
|
@@ -331,7 +356,8 @@ module Aws
|
|
331
356
|
loop do
|
332
357
|
messages = get_messages(config, stats)
|
333
358
|
if messages.empty?
|
334
|
-
check_idle_timeout(config, stats
|
359
|
+
check_idle_timeout(config, stats)
|
360
|
+
config.after_empty_receive&.call(stats)
|
335
361
|
else
|
336
362
|
process_messages(config, stats, messages, &block)
|
337
363
|
end
|
@@ -346,21 +372,21 @@ module Aws
|
|
346
372
|
# `#receipt_handle`.
|
347
373
|
# @param [Integer] seconds
|
348
374
|
def change_message_visibility_timeout(message, seconds)
|
349
|
-
@client.change_message_visibility(
|
375
|
+
@client.change_message_visibility(
|
350
376
|
queue_url: @queue_url,
|
351
377
|
receipt_handle: message.receipt_handle,
|
352
|
-
visibility_timeout: seconds
|
353
|
-
|
378
|
+
visibility_timeout: seconds
|
379
|
+
)
|
354
380
|
end
|
355
381
|
|
356
382
|
# @note This method should be called from inside a {#poll} block.
|
357
383
|
# @param [#receipt_handle] message An object that responds to
|
358
384
|
# `#receipt_handle`.
|
359
385
|
def delete_message(message)
|
360
|
-
@client.delete_message(
|
386
|
+
@client.delete_message(
|
361
387
|
queue_url: @queue_url,
|
362
|
-
receipt_handle: message.receipt_handle
|
363
|
-
|
388
|
+
receipt_handle: message.receipt_handle
|
389
|
+
)
|
364
390
|
end
|
365
391
|
|
366
392
|
# @note This method should be called from inside a {#poll} block.
|
@@ -370,16 +396,16 @@ module Aws
|
|
370
396
|
def delete_messages(messages)
|
371
397
|
@client.delete_message_batch(
|
372
398
|
queue_url: @queue_url,
|
373
|
-
entries: messages.map
|
399
|
+
entries: messages.map do |msg|
|
374
400
|
{ id: msg.message_id, receipt_handle: msg.receipt_handle }
|
375
|
-
|
401
|
+
end
|
376
402
|
)
|
377
403
|
end
|
378
404
|
|
379
405
|
private
|
380
406
|
|
381
407
|
def get_messages(config, stats)
|
382
|
-
config.before_request
|
408
|
+
config.before_request&.call(stats)
|
383
409
|
messages = send_request(config).messages
|
384
410
|
stats.request_count += 1
|
385
411
|
messages
|
@@ -390,17 +416,22 @@ module Aws
|
|
390
416
|
@client.receive_message(params)
|
391
417
|
end
|
392
418
|
|
393
|
-
def check_idle_timeout(config, stats
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
419
|
+
def check_idle_timeout(config, stats)
|
420
|
+
return unless config.idle_timeout
|
421
|
+
|
422
|
+
since = stats.last_message_received_at || stats.polling_started_at
|
423
|
+
idle_time = Time.now - since
|
424
|
+
throw :stop_polling if idle_time > config.idle_timeout
|
399
425
|
end
|
400
426
|
|
401
427
|
def process_messages(config, stats, messages, &block)
|
402
428
|
stats.received_message_count += messages.count
|
403
429
|
stats.last_message_received_at = Time.now
|
430
|
+
|
431
|
+
# duplicated messages will have a different receipt handle
|
432
|
+
# so we need to provide the most recent receipt to
|
433
|
+
# delete a batch - thus, filtering below by message_id
|
434
|
+
messages = messages.reverse.uniq(&:message_id).reverse!
|
404
435
|
catch(:skip_delete) do
|
405
436
|
yield_messages(config, messages, stats, &block)
|
406
437
|
delete_messages(messages) unless config.skip_delete
|
@@ -419,7 +450,6 @@ module Aws
|
|
419
450
|
|
420
451
|
# Statistics tracked client-side by the {QueuePoller}.
|
421
452
|
class PollerStats
|
422
|
-
|
423
453
|
def initialize
|
424
454
|
@request_count = 0
|
425
455
|
@received_message_count = 0
|
@@ -442,27 +472,26 @@ module Aws
|
|
442
472
|
|
443
473
|
# @return [Time,nil]
|
444
474
|
attr_accessor :polling_stopped_at
|
445
|
-
|
446
475
|
end
|
447
476
|
|
448
477
|
# A read-only set of configuration used by the QueuePoller.
|
449
478
|
class PollerConfig
|
450
|
-
|
451
479
|
# @api private
|
452
|
-
CONFIG_OPTIONS = Set.new
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
480
|
+
CONFIG_OPTIONS = Set.new %i[
|
481
|
+
idle_timeout
|
482
|
+
skip_delete
|
483
|
+
before_request
|
484
|
+
after_empty_receive
|
485
|
+
]
|
457
486
|
|
458
487
|
# @api private
|
459
|
-
PARAM_OPTIONS = Set.new
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
]
|
488
|
+
PARAM_OPTIONS = Set.new %i[
|
489
|
+
wait_time_seconds
|
490
|
+
max_number_of_messages
|
491
|
+
visibility_timeout
|
492
|
+
attribute_names
|
493
|
+
message_attribute_names
|
494
|
+
]
|
466
495
|
|
467
496
|
# @return [Integer,nil]
|
468
497
|
attr_reader :idle_timeout
|
@@ -473,6 +502,9 @@ module Aws
|
|
473
502
|
# @return [Proc,nil]
|
474
503
|
attr_reader :before_request
|
475
504
|
|
505
|
+
# @return [Proc,nil]
|
506
|
+
attr_reader :after_empty_receive
|
507
|
+
|
476
508
|
# @return [Hash]
|
477
509
|
attr_reader :request_params
|
478
510
|
|
@@ -480,12 +512,13 @@ module Aws
|
|
480
512
|
@idle_timeout = nil
|
481
513
|
@skip_delete = false
|
482
514
|
@before_request = nil
|
515
|
+
@after_empty_receive = nil
|
483
516
|
@request_params = {
|
484
517
|
wait_time_seconds: 20,
|
485
518
|
max_number_of_messages: 1,
|
486
519
|
visibility_timeout: nil,
|
487
520
|
attribute_names: ['All'],
|
488
|
-
message_attribute_names: ['All']
|
521
|
+
message_attribute_names: ['All']
|
489
522
|
}
|
490
523
|
options.each do |opt_name, value|
|
491
524
|
if CONFIG_OPTIONS.include?(opt_name)
|
@@ -496,6 +529,12 @@ module Aws
|
|
496
529
|
raise ArgumentError, "invalid option #{opt_name.inspect}"
|
497
530
|
end
|
498
531
|
end
|
532
|
+
|
533
|
+
max_number_of_messages = @request_params[:max_number_of_messages]
|
534
|
+
unless max_number_of_messages.is_a?(Integer) && max_number_of_messages.positive?
|
535
|
+
raise ArgumentError, ':max_number_of_messages must be a positive integer'
|
536
|
+
end
|
537
|
+
|
499
538
|
@request_params.freeze
|
500
539
|
freeze
|
501
540
|
end
|
@@ -514,7 +553,6 @@ module Aws
|
|
514
553
|
PARAM_OPTIONS.each { |key| hash[key] = @request_params[key] }
|
515
554
|
hash
|
516
555
|
end
|
517
|
-
|
518
556
|
end
|
519
557
|
end
|
520
558
|
end
|
data/lib/aws-sdk-sqs/resource.rb
CHANGED
@@ -1,18 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# WARNING ABOUT GENERATED CODE
|
2
4
|
#
|
3
5
|
# This file is generated. See the contributing guide for more information:
|
4
|
-
# https://github.com/aws/aws-sdk-ruby/blob/
|
6
|
+
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
|
5
7
|
#
|
6
8
|
# WARNING ABOUT GENERATED CODE
|
7
9
|
|
8
10
|
module Aws::SQS
|
11
|
+
|
9
12
|
# This class provides a resource oriented interface for SQS.
|
10
13
|
# To create a resource object:
|
14
|
+
#
|
11
15
|
# resource = Aws::SQS::Resource.new(region: 'us-west-2')
|
16
|
+
#
|
12
17
|
# You can supply a client object with custom configuration that will be used for all resource operations.
|
13
|
-
# If you do not pass
|
18
|
+
# If you do not pass `:client`, a default client will be constructed.
|
19
|
+
#
|
14
20
|
# client = Aws::SQS::Client.new(region: 'us-west-2')
|
15
21
|
# resource = Aws::SQS::Resource.new(client: client)
|
22
|
+
#
|
16
23
|
class Resource
|
17
24
|
|
18
25
|
# @param options ({})
|
@@ -57,92 +64,130 @@ module Aws::SQS
|
|
57
64
|
# The following lists the names, descriptions, and values of the special
|
58
65
|
# request parameters that the `CreateQueue` action uses:
|
59
66
|
#
|
60
|
-
# * `DelaySeconds`
|
67
|
+
# * `DelaySeconds` – The length of time, in seconds, for which the
|
61
68
|
# delivery of all messages in the queue is delayed. Valid values: An
|
62
69
|
# integer from 0 to 900 seconds (15 minutes). Default: 0.
|
63
70
|
#
|
64
|
-
# * `MaximumMessageSize`
|
71
|
+
# * `MaximumMessageSize` – The limit of how many bytes a message can
|
65
72
|
# contain before Amazon SQS rejects it. Valid values: An integer from
|
66
73
|
# 1,024 bytes (1 KiB) to 262,144 bytes (256 KiB). Default: 262,144
|
67
74
|
# (256 KiB).
|
68
75
|
#
|
69
|
-
# * `MessageRetentionPeriod`
|
76
|
+
# * `MessageRetentionPeriod` – The length of time, in seconds, for which
|
70
77
|
# Amazon SQS retains a message. Valid values: An integer from 60
|
71
78
|
# seconds (1 minute) to 1,209,600 seconds (14 days). Default: 345,600
|
72
|
-
# (4 days).
|
73
|
-
#
|
74
|
-
#
|
75
|
-
#
|
76
|
-
#
|
77
|
-
#
|
78
|
-
#
|
79
|
+
# (4 days). When you change a queue's attributes, the change can take
|
80
|
+
# up to 60 seconds for most of the attributes to propagate throughout
|
81
|
+
# the Amazon SQS system. Changes made to the `MessageRetentionPeriod`
|
82
|
+
# attribute can take up to 15 minutes and will impact existing
|
83
|
+
# messages in the queue potentially causing them to be expired and
|
84
|
+
# deleted if the `MessageRetentionPeriod` is reduced below the age of
|
85
|
+
# existing messages.
|
86
|
+
#
|
87
|
+
# * `Policy` – The queue's policy. A valid Amazon Web Services policy.
|
88
|
+
# For more information about policy structure, see [Overview of Amazon
|
89
|
+
# Web Services IAM Policies][1] in the *IAM User Guide*.
|
90
|
+
#
|
91
|
+
# * `ReceiveMessageWaitTimeSeconds` – The length of time, in seconds,
|
79
92
|
# for which a ` ReceiveMessage ` action waits for a message to arrive.
|
80
93
|
# Valid values: An integer from 0 to 20 (seconds). Default: 0.
|
81
94
|
#
|
82
|
-
# * `
|
83
|
-
#
|
84
|
-
# information about the
|
85
|
-
# [
|
86
|
-
#
|
95
|
+
# * `VisibilityTimeout` – The visibility timeout for the queue, in
|
96
|
+
# seconds. Valid values: An integer from 0 to 43,200 (12 hours).
|
97
|
+
# Default: 30. For more information about the visibility timeout, see
|
98
|
+
# [Visibility Timeout][2] in the *Amazon SQS Developer Guide*.
|
99
|
+
#
|
100
|
+
# The following attributes apply only to [dead-letter queues:][3]
|
101
|
+
#
|
102
|
+
# * `RedrivePolicy` – The string that includes the parameters for the
|
103
|
+
# dead-letter queue functionality of the source queue as a JSON
|
104
|
+
# object. The parameters are as follows:
|
87
105
|
#
|
88
|
-
# * `deadLetterTargetArn`
|
106
|
+
# * `deadLetterTargetArn` – The Amazon Resource Name (ARN) of the
|
89
107
|
# dead-letter queue to which Amazon SQS moves messages after the
|
90
108
|
# value of `maxReceiveCount` is exceeded.
|
91
109
|
#
|
92
|
-
# * `maxReceiveCount`
|
93
|
-
# the source queue before being moved to the dead-letter queue.
|
94
|
-
# the `ReceiveCount` for a message exceeds the
|
95
|
-
# a queue, Amazon SQS moves the message to the
|
110
|
+
# * `maxReceiveCount` – The number of times a message is delivered to
|
111
|
+
# the source queue before being moved to the dead-letter queue.
|
112
|
+
# Default: 10. When the `ReceiveCount` for a message exceeds the
|
113
|
+
# `maxReceiveCount` for a queue, Amazon SQS moves the message to the
|
114
|
+
# dead-letter-queue.
|
96
115
|
#
|
97
|
-
#
|
98
|
-
#
|
99
|
-
#
|
116
|
+
# * `RedriveAllowPolicy` – The string that includes the parameters for
|
117
|
+
# the permissions for the dead-letter queue redrive permission and
|
118
|
+
# which source queues can specify dead-letter queues as a JSON object.
|
119
|
+
# The parameters are as follows:
|
100
120
|
#
|
101
|
-
#
|
121
|
+
# * `redrivePermission` – The permission type that defines which
|
122
|
+
# source queues can specify the current queue as the dead-letter
|
123
|
+
# queue. Valid values are:
|
102
124
|
#
|
103
|
-
#
|
104
|
-
#
|
105
|
-
#
|
106
|
-
#
|
107
|
-
#
|
125
|
+
# * `allowAll` – (Default) Any source queues in this Amazon Web
|
126
|
+
# Services account in the same Region can specify this queue as
|
127
|
+
# the dead-letter queue.
|
128
|
+
#
|
129
|
+
# * `denyAll` – No source queues can specify this queue as the
|
130
|
+
# dead-letter queue.
|
108
131
|
#
|
109
|
-
#
|
132
|
+
# * `byQueue` – Only queues specified by the `sourceQueueArns`
|
133
|
+
# parameter can specify this queue as the dead-letter queue.
|
134
|
+
#
|
135
|
+
# * `sourceQueueArns` – The Amazon Resource Names (ARN)s of the source
|
136
|
+
# queues that can specify this queue as the dead-letter queue and
|
137
|
+
# redrive messages. You can specify this parameter only when the
|
138
|
+
# `redrivePermission` parameter is set to `byQueue`. You can specify
|
139
|
+
# up to 10 source queue ARNs. To allow more than 10 source queues to
|
140
|
+
# specify dead-letter queues, set the `redrivePermission` parameter
|
141
|
+
# to `allowAll`.
|
142
|
+
#
|
143
|
+
# <note markdown="1"> The dead-letter queue of a FIFO queue must also be a FIFO queue.
|
144
|
+
# Similarly, the dead-letter queue of a standard queue must also be a
|
145
|
+
# standard queue.
|
146
|
+
#
|
147
|
+
# </note>
|
110
148
|
#
|
111
|
-
#
|
112
|
-
# (CMK) for Amazon SQS or a custom CMK. For more information, see [Key
|
113
|
-
# Terms][5]. While the alias of the AWS-managed CMK for Amazon SQS is
|
114
|
-
# always `alias/aws/sqs`, the alias of a custom CMK can, for example,
|
115
|
-
# be `alias/MyAlias `. For more examples, see [KeyId][6] in the *AWS
|
116
|
-
# Key Management Service API Reference*.
|
149
|
+
# The following attributes apply only to [server-side-encryption][4]:
|
117
150
|
#
|
118
|
-
# * `
|
151
|
+
# * `KmsMasterKeyId` – The ID of an Amazon Web Services managed customer
|
152
|
+
# master key (CMK) for Amazon SQS or a custom CMK. For more
|
153
|
+
# information, see [Key Terms][5]. While the alias of the Amazon Web
|
154
|
+
# Services managed CMK for Amazon SQS is always `alias/aws/sqs`, the
|
155
|
+
# alias of a custom CMK can, for example, be `alias/MyAlias `. For
|
156
|
+
# more examples, see [KeyId][6] in the *Key Management Service API
|
157
|
+
# Reference*.
|
158
|
+
#
|
159
|
+
# * `KmsDataKeyReusePeriodSeconds` – The length of time, in seconds, for
|
119
160
|
# which Amazon SQS can reuse a [data key][7] to encrypt or decrypt
|
120
|
-
# messages before calling
|
121
|
-
#
|
122
|
-
#
|
123
|
-
#
|
124
|
-
#
|
125
|
-
#
|
161
|
+
# messages before calling KMS again. An integer representing seconds,
|
162
|
+
# between 60 seconds (1 minute) and 86,400 seconds (24 hours).
|
163
|
+
# Default: 300 (5 minutes). A shorter time period provides better
|
164
|
+
# security but results in more calls to KMS which might incur charges
|
165
|
+
# after Free Tier. For more information, see [How Does the Data Key
|
166
|
+
# Reuse Period Work?][8]
|
126
167
|
#
|
127
|
-
#
|
128
|
-
#
|
168
|
+
# * `SqsManagedSseEnabled` – Enables server-side queue encryption using
|
169
|
+
# SQS owned encryption keys. Only one server-side encryption option is
|
170
|
+
# supported per queue (for example, [SSE-KMS][9] or [SSE-SQS][10]).
|
129
171
|
#
|
130
|
-
#
|
131
|
-
#
|
132
|
-
# creates a standard queue. You can provide this attribute only during
|
133
|
-
# queue creation. You can't change it for an existing queue. When you
|
134
|
-
# set this attribute, you must also provide the `MessageGroupId` for
|
135
|
-
# your messages explicitly.
|
172
|
+
# The following attributes apply only to [FIFO (first-in-first-out)
|
173
|
+
# queues][11]:
|
136
174
|
#
|
137
|
-
#
|
138
|
-
#
|
175
|
+
# * `FifoQueue` – Designates a queue as FIFO. Valid values are `true`
|
176
|
+
# and `false`. If you don't specify the `FifoQueue` attribute, Amazon
|
177
|
+
# SQS creates a standard queue. You can provide this attribute only
|
178
|
+
# during queue creation. You can't change it for an existing queue.
|
179
|
+
# When you set this attribute, you must also provide the
|
180
|
+
# `MessageGroupId` for your messages explicitly.
|
139
181
|
#
|
140
|
-
#
|
141
|
-
# Valid values: `true`, `false`. For more information, see
|
142
|
-
# [Exactly-Once Processing][11] in the *Amazon Simple Queue Service
|
182
|
+
# For more information, see [FIFO queue logic][12] in the *Amazon SQS
|
143
183
|
# Developer Guide*.
|
144
184
|
#
|
145
|
-
#
|
185
|
+
# * `ContentBasedDeduplication` – Enables content-based deduplication.
|
186
|
+
# Valid values are `true` and `false`. For more information, see
|
187
|
+
# [Exactly-once processing][13] in the *Amazon SQS Developer Guide*.
|
188
|
+
# Note the following:
|
189
|
+
#
|
190
|
+
# * Every message must have a unique `MessageDeduplicationId`.
|
146
191
|
#
|
147
192
|
# * You may provide a `MessageDeduplicationId` explicitly.
|
148
193
|
#
|
@@ -170,23 +215,53 @@ module Aws::SQS
|
|
170
215
|
# `MessageDeduplicationId`, the two messages are treated as
|
171
216
|
# duplicates and only one copy of the message is delivered.
|
172
217
|
#
|
218
|
+
# The following attributes apply only to [high throughput for FIFO
|
219
|
+
# queues][14]:
|
220
|
+
#
|
221
|
+
# * `DeduplicationScope` – Specifies whether message deduplication
|
222
|
+
# occurs at the message group or queue level. Valid values are
|
223
|
+
# `messageGroup` and `queue`.
|
224
|
+
#
|
225
|
+
# * `FifoThroughputLimit` – Specifies whether the FIFO queue throughput
|
226
|
+
# quota applies to the entire queue or per message group. Valid values
|
227
|
+
# are `perQueue` and `perMessageGroupId`. The `perMessageGroupId`
|
228
|
+
# value is allowed only when the value for `DeduplicationScope` is
|
229
|
+
# `messageGroup`.
|
230
|
+
#
|
231
|
+
# To enable high throughput for FIFO queues, do the following:
|
232
|
+
#
|
233
|
+
# * Set `DeduplicationScope` to `messageGroup`.
|
234
|
+
#
|
235
|
+
# * Set `FifoThroughputLimit` to `perMessageGroupId`.
|
236
|
+
#
|
237
|
+
# If you set these attributes to anything other than the values shown
|
238
|
+
# for enabling high throughput, normal throughput is in effect and
|
239
|
+
# deduplication occurs as specified.
|
240
|
+
#
|
241
|
+
# For information on throughput quotas, see [Quotas related to
|
242
|
+
# messages][15] in the *Amazon SQS Developer Guide*.
|
243
|
+
#
|
173
244
|
#
|
174
245
|
#
|
175
246
|
# [1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/PoliciesOverview.html
|
176
|
-
# [2]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-
|
177
|
-
# [3]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-
|
247
|
+
# [2]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html
|
248
|
+
# [3]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html
|
178
249
|
# [4]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html
|
179
250
|
# [5]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html#sqs-sse-key-terms
|
180
251
|
# [6]: https://docs.aws.amazon.com/kms/latest/APIReference/API_DescribeKey.html#API_DescribeKey_RequestParameters
|
181
252
|
# [7]: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#data-keys
|
182
253
|
# [8]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-server-side-encryption.html#sqs-how-does-the-data-key-reuse-period-work
|
183
|
-
# [9]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/
|
184
|
-
# [10]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/
|
185
|
-
# [11]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html
|
254
|
+
# [9]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sse-existing-queue.html
|
255
|
+
# [10]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-configure-sqs-sse-queue.html
|
256
|
+
# [11]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues.html
|
257
|
+
# [12]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues-understanding-logic.html
|
258
|
+
# [13]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/FIFO-queues-exactly-once-processing.html
|
259
|
+
# [14]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/high-throughput-fifo.html
|
260
|
+
# [15]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/quotas-messages.html
|
186
261
|
# @option options [Hash<String,String>] :tags
|
187
262
|
# Add cost allocation tags to the specified Amazon SQS queue. For an
|
188
|
-
# overview, see [Tagging Your Amazon SQS Queues][1] in the *Amazon
|
189
|
-
#
|
263
|
+
# overview, see [Tagging Your Amazon SQS Queues][1] in the *Amazon SQS
|
264
|
+
# Developer Guide*.
|
190
265
|
#
|
191
266
|
# When you use queue tags, keep the following guidelines in mind:
|
192
267
|
#
|
@@ -200,15 +275,15 @@ module Aws::SQS
|
|
200
275
|
# * A new tag with a key identical to that of an existing tag overwrites
|
201
276
|
# the existing tag.
|
202
277
|
#
|
203
|
-
# For a full list of tag restrictions, see [
|
204
|
-
# in the *Amazon
|
278
|
+
# For a full list of tag restrictions, see [Quotas related to queues][2]
|
279
|
+
# in the *Amazon SQS Developer Guide*.
|
205
280
|
#
|
206
281
|
# <note markdown="1"> To be able to tag a queue on creation, you must have the
|
207
282
|
# `sqs:CreateQueue` and `sqs:TagQueue` permissions.
|
208
283
|
#
|
209
284
|
# Cross-account permissions don't apply to this action. For more
|
210
|
-
# information, see [Grant
|
211
|
-
#
|
285
|
+
# information, see [Grant cross-account permissions to a role and a
|
286
|
+
# username][3] in the *Amazon SQS Developer Guide*.
|
212
287
|
#
|
213
288
|
# </note>
|
214
289
|
#
|
@@ -219,7 +294,9 @@ module Aws::SQS
|
|
219
294
|
# [3]: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-customer-managed-policy-examples.html#grant-cross-account-permissions-to-role-and-user-name
|
220
295
|
# @return [Queue]
|
221
296
|
def create_queue(options = {})
|
222
|
-
resp =
|
297
|
+
resp = Aws::Plugins::UserAgent.feature('resource') do
|
298
|
+
@client.create_queue(options)
|
299
|
+
end
|
223
300
|
Queue.new(
|
224
301
|
url: resp.data.queue_url,
|
225
302
|
client: @client
|
@@ -240,10 +317,13 @@ module Aws::SQS
|
|
240
317
|
#
|
241
318
|
# Queue URLs and names are case-sensitive.
|
242
319
|
# @option options [String] :queue_owner_aws_account_id
|
243
|
-
# The
|
320
|
+
# The Amazon Web Services account ID of the account that created the
|
321
|
+
# queue.
|
244
322
|
# @return [Queue]
|
245
323
|
def get_queue_by_name(options = {})
|
246
|
-
resp =
|
324
|
+
resp = Aws::Plugins::UserAgent.feature('resource') do
|
325
|
+
@client.get_queue_url(options)
|
326
|
+
end
|
247
327
|
Queue.new(
|
248
328
|
url: resp.data.queue_url,
|
249
329
|
client: @client
|
@@ -275,15 +355,19 @@ module Aws::SQS
|
|
275
355
|
# @return [Queue::Collection]
|
276
356
|
def queues(options = {})
|
277
357
|
batches = Enumerator.new do |y|
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
358
|
+
resp = Aws::Plugins::UserAgent.feature('resource') do
|
359
|
+
@client.list_queues(options)
|
360
|
+
end
|
361
|
+
resp.each_page do |page|
|
362
|
+
batch = []
|
363
|
+
page.data.queue_urls.each do |q|
|
364
|
+
batch << Queue.new(
|
365
|
+
url: q,
|
366
|
+
client: @client
|
367
|
+
)
|
368
|
+
end
|
369
|
+
y.yield(batch)
|
285
370
|
end
|
286
|
-
y.yield(batch)
|
287
371
|
end
|
288
372
|
Queue::Collection.new(batches)
|
289
373
|
end
|