lib/propono/components/queue_subscription.rb in propono-1.0.0.rc2 vs lib/propono/components/queue_subscription.rb in propono-1.0.0.rc3

- old
+ new

@@ -2,27 +2,29 @@ class QueueSubscription include Sns include Sqs - attr_reader :topic_arn, :queue_name, :queue + attr_reader :topic_arn, :queue_name, :queue, :failed_queue, :corrupt_queue def self.create(topic_id, options = {}) new(topic_id, options).tap do |subscription| subscription.create end end def initialize(topic_id, options = {}) @topic_id = topic_id @suffixed_topic_id = "#{topic_id}#{Propono.config.queue_suffix}" - @queue_name = "#{Propono.config.application_name.gsub(" ", "_")}-#{@suffixed_topic_id}#{options[:queue_name_suffix]}" + @queue_name = "#{Propono.config.application_name.gsub(" ", "_")}-#{@suffixed_topic_id}" end def create raise ProponoError.new("topic_id is nil") unless @topic_id @topic = TopicCreator.find_or_create(@suffixed_topic_id) @queue = QueueCreator.find_or_create(queue_name) + @failed_queue = QueueCreator.find_or_create("#{queue_name}-failed") + @corrupt_queue = QueueCreator.find_or_create("#{queue_name}-corrupt") sns.subscribe(@topic.arn, @queue.arn, 'sqs') sqs.set_queue_attributes(@queue.url, "Policy", generate_policy) end private