Class: WithEvents::Aws::Topic

Inherits:
Object
  • Object
show all
Defined in:
lib/with_events/aws/topic.rb

Instance Method Summary collapse

Constructor Details

#initialize(topic = nil) ⇒ Topic

Returns a new instance of Topic.



27
28
29
# File 'lib/with_events/aws/topic.rb', line 27

def initialize(topic = nil)
  @topic = topic
end

Instance Method Details

#publish(message) ⇒ Object



31
32
33
# File 'lib/with_events/aws/topic.rb', line 31

def publish(message)
  Circuitry.publish(topic, message.serialize)
end

#subscribe(options = {}, &block) ⇒ Object



35
36
37
38
39
# File 'lib/with_events/aws/topic.rb', line 35

def subscribe(options = {}, &block)
  Circuitry.subscribe(options) do |message, topic_name|
    skip_delete unless positive_result?(topic_name, message, &block)
  end
end