Module: SQS
Instance Method Summary collapse
- #all_queues ⇒ Object
- #delete_message_batch(queue_url, batch) ⇒ Object
- #read_message_batches(queue_url, &block) ⇒ Object
- #send_message_batch(queue_url, batch) ⇒ Object
Instance Method Details
#all_queues ⇒ Object
6 7 8 |
# File 'lib/sqs_cli/sqs.rb', line 6 def all_queues sqs.list_queues.queue_urls end |
#delete_message_batch(queue_url, batch) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/sqs_cli/sqs.rb', line 29 def (queue_url, batch) entries = batch.map do |m| { id: m., receipt_handle: m.receipt_handle } end sqs.(queue_url: queue_url, entries: entries) end |
#read_message_batches(queue_url, &block) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/sqs_cli/sqs.rb', line 10 def (queue_url, &block) loop do resp = sqs.( queue_url: queue_url, max_number_of_messages: 10, visibility_timeout: 10 ) break if resp..empty? block.call resp. end end |
#send_message_batch(queue_url, batch) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/sqs_cli/sqs.rb', line 22 def (queue_url, batch) entries = batch.map do |msg| { id: msg., message_body: msg.body } end sqs.(queue_url: queue_url, entries: entries) end |