Sha256: d80c36218ad3e10cf8acdb8b7c1f2dc1cfee08bacc279d75ef47c5170d426b78
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
require 'aws-sdk' require 'alephant/logger' module Alephant module Publisher module Queue class InvalidKeySpecifiedError < StandardError; end class Options include Logger attr_reader :queue, :writer QUEUE_OPTS = [ :receive_wait_time, :sqs_queue_name, :visibility_timeout, :aws_account_id ] WRITER_OPTS = [ :lookup_table_name, :msg_vary_id_path, :renderer_id, :s3_bucket_id, :s3_object_path, :sequence_id_path, :sequencer_table_name, :view_path ] def initialize @queue = {} @writer = {} end def add_queue(opts) execute @queue, QUEUE_OPTS, opts end def add_writer(opts) execute @writer, WRITER_OPTS, opts end private def execute(instance, type, opts) begin validate type, opts instance.merge! opts rescue Exception => e logger.metric "QueueOptionsInvalidKeySpecified" logger.error "Publisher::Queue::Options#validate: '#{e.message}'" puts e.message end end def validate(type, opts) opts.each do |key, value| raise InvalidKeySpecifiedError, "The key '#{key}' is invalid" unless type.include? key.to_sym end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alephant-publisher-queue-1.3.6 | lib/alephant/publisher/queue/options.rb |