Sha256: e8c6bc1b4d0e98433dc39cf723ae6cca1601bed7c3db5a25a9cf7eda536477da

Contents?: true

Size: 760 Bytes

Versions: 2

Compression:

Stored size: 760 Bytes

Contents

module FakeSQS
  module Actions
    class ListDeadLetterSourceQueues

      def initialize(options = {})
        @server    = options.fetch(:server)
        @queues    = options.fetch(:queues)
        @responder = options.fetch(:responder)
      end

      def call(queue_name, params)
        queue_arn = @queues.get(queue_name).arn
        queue_urls = @queues.list.select do |queue|
          redrive_policy = queue.attributes.fetch("RedrivePolicy", nil)
          redrive_policy && redrive_policy =~ /deadLetterTargetArn\":\"#{queue_arn}/
        end
        @responder.call :ListDeadLetterSourceQueues do |xml|
          queue_urls.each do |queue|
            xml.QueueUrl @server.url_for(queue.name)
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fake_sqs-0.4.3 lib/fake_sqs/actions/list_dead_letter_source_queues.rb
fake_sqs-0.4.2 lib/fake_sqs/actions/list_dead_letter_source_queues.rb