lib/alephant/publisher/queue.rb in alephant-publisher-queue-2.0.0 vs lib/alephant/publisher/queue.rb in alephant-publisher-queue-2.0.1
- old
+ new
@@ -49,11 +49,11 @@
def archiver_opts
options = {
:log_archive_message => true,
:async_store => true
}
- options.each do |key, value|
+ options.each do |key, _value|
options[key] = opts.queue[key] == "true" if opts.queue.has_key? key
end
end
def archive_cache
@@ -66,20 +66,28 @@
def sqs_client
@sqs_client ||= AWS::SQS.new
end
def sqs_queue_options
- (opts.queue[:aws_account_id].nil? ? {} : { :queue_owner_aws_account_id => opts.queue[:aws_account_id] }).tap do |ops|
+ (opts.queue[:aws_account_id].nil? ? {} : fallback).tap do |ops|
logger.info(
"event" => "SQSQueueOptionsConfigured",
"options" => ops,
"method" => "#{self.class}#sqs_queue_options"
)
end
end
+ def fallback
+ {
+ :queue_owner_aws_account_id => opts.queue[:aws_account_id]
+ }
+ end
+
def aws_queue
- queue_url = sqs_client.queues.url_for(opts.queue[:sqs_queue_name], sqs_queue_options)
+ queue_url = sqs_client.queues.url_for(
+ opts.queue[:sqs_queue_name], sqs_queue_options
+ )
sqs_client.queues[queue_url]
end
end
end
end