Class: Icalia::Event::Publisher

Inherits:
Object
  • Object
show all
Defined in:
lib/icalia/event/publisher.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePublisher

Returns a new instance of Publisher.



33
34
35
36
# File 'lib/icalia/event/publisher.rb', line 33

def initialize
  initialize_pubsub_client
  initialize_logger
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



29
30
31
# File 'lib/icalia/event/publisher.rb', line 29

def client
  @client
end

#loggerObject (readonly)

Returns the value of attribute logger.



29
30
31
# File 'lib/icalia/event/publisher.rb', line 29

def logger
  @logger
end

Class Method Details

.instanceObject



22
23
24
# File 'lib/icalia/event/publisher.rb', line 22

def instance
  @instance ||= new
end

Instance Method Details

#publish(topic_name, data, attributes = {}) ⇒ Object



38
39
40
41
# File 'lib/icalia/event/publisher.rb', line 38

def publish(topic_name, data, attributes = {})
  logger.debug "Publishing to '#{topic_name}': #{data.inspect}"
  get_or_create_topic(topic_name).publish message_pack(data), attributes
end