Class: Aws::Broker::Publisher

Inherits:
Base
  • Object
show all
Defined in:
lib/aws/broker/publisher.rb

Instance Method Summary collapse

Constructor Details

#initialize(topic, message) ⇒ Publisher

Returns a new instance of Publisher.



7
8
9
10
# File 'lib/aws/broker/publisher.rb', line 7

def initialize(topic, message)
  @topic = topic
  @message = message
end

Instance Method Details

#publishObject



12
13
14
15
16
17
18
19
# File 'lib/aws/broker/publisher.rb', line 12

def publish
  return unless enabled?
  create_topic
  sns.publish(
    topic_arn: @topic_arn,
    message:   @message.to_json
  )
end