lib/propono/components/queue_subscription.rb in propono-0.9.1 vs lib/propono/components/queue_subscription.rb in propono-0.10.0
- old
+ new
@@ -12,20 +12,22 @@
end
end
def initialize(topic_id)
@topic_id = topic_id
+ @suffixed_topic_id = "#{topic_id}#{Propono.config.queue_suffix}"
end
def create
- @topic = TopicCreator.find_or_create(@topic_id)
+ 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)
sns.subscribe(@topic.arn, @queue.arn, 'sqs')
sqs.set_queue_attributes(@queue.url, "Policy", generate_policy)
end
def queue_name
- @queue_name ||= "#{Propono.config.application_name.gsub(" ", "_")}-#{@topic_id}"
+ @queue_name ||= "#{Propono.config.application_name.gsub(" ", "_")}-#{@suffixed_topic_id}"
end
private
def generate_policy