Sha256: e96ec2d567acccd48c9e294d4ebd943cc809374d0bdaa8100bf8421fc5c522f8

Contents?: true

Size: 503 Bytes

Versions: 1

Compression:

Stored size: 503 Bytes

Contents

module Propono
  class QueueSubscriber

    include Sns
    include Sqs

    attr_reader :topic_arn, :queue

    def self.subscribe(topic_id)
      new(topic_id).subscribe
    end

    def initialize(topic_id)
      @topic_id = topic_id
    end

    def subscribe
      @topic_arn = TopicCreator.find_or_create(@topic_id)
      @queue = QueueCreator.find_or_create(queue_name)
      sns.subscribe(@topic_arn, @queue.arn, 'sqs')
    end

    private

    def queue_name
      @topic_id
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
propono-0.1.0 lib/propono/queue_subscriber.rb