Sha256: efd26e8ef90ea37121ef2fae6eb99a18da9b4cf3c0f57fb2594a9efa6bb6a98e

Contents?: true

Size: 588 Bytes

Versions: 11

Compression:

Stored size: 588 Bytes

Contents

require 'aws-sdk'

# Retrieve all available messages from the specified queue.
#
# Rather than utilizing `Aws::SQS::QueuePoller` directly in order to poll an
# SQS queue for messages, this method retrieves and returns all messages that
# are able to be received from the specified SQS queue.
def receive_all_messages(queue_url, options = {})
  options[:idle_timeout] ||= 0
  options[:max_number_of_messages] ||= 10

  messages = []
  poller = Aws::SQS::QueuePoller.new(queue_url, options)

  poller.poll do |received_messages|
    messages.concat(received_messages)
  end

  messages
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
logstash-output-sqs-6.0.0 spec/supports/helpers.rb
logstash-output-sqs-5.1.2 spec/supports/helpers.rb
logstash-output-sqs-5.1.1 spec/supports/helpers.rb
logstash-output-sqs-5.1.0 spec/supports/helpers.rb
logstash-output-sqs-5.0.2 spec/supports/helpers.rb
logstash-output-sqs-4.0.3 spec/supports/helpers.rb
logstash-output-sqs-5.0.1 spec/supports/helpers.rb
logstash-output-sqs-5.0.0 spec/supports/helpers.rb
logstash-output-sqs-4.0.2 spec/supports/helpers.rb
logstash-output-sqs-4.0.1 spec/supports/helpers.rb
logstash-output-sqs-4.0.0 spec/supports/helpers.rb