Class: Ruboty::SqsMonitor::Aws::Sqs

Inherits:
Object
  • Object
show all
Defined in:
lib/ruboty/sqs_monitor/aws/sqs.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, options) ⇒ Sqs

Returns a new instance of Sqs.



5
6
7
8
9
10
# File 'lib/ruboty/sqs_monitor/aws/sqs.rb', line 5

def initialize(name, options)
  @name = name

  opts = options.select {|k, v| CLIENT_OPTIONS.include? k.to_sym }
  @client = ::Aws::SQS::Client.new(opts)
end

Instance Method Details

#exists?Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
# File 'lib/ruboty/sqs_monitor/aws/sqs.rb', line 12

def exists?
  result = @client.list_queues(queue_name_prefix: @name)
  !!result.queue_urls.find {|url| url.to_s.end_with? @name }
rescue
  false
end