class Kiyohime::Publisher

A publisher can be used to publish a message to a specific function. It also has the facility to list the names of the available functions

Attributes

store[R]

Public Class Methods

new(store = nil) click to toggle source

Initialises the publisher by obtaining a Redis connection

# File lib/kiyohime/publisher.rb, line 11
def initialize(store = nil)
  @store = store || Kiyohime::Stores::RedisStore.new.redis
end

Public Instance Methods

publish(service, message) click to toggle source

A message can be published to a service/function, a message can be a simple type, or at present a JSON compliant type

# File lib/kiyohime/publisher.rb, line 17
def publish(service, message)
  if store
    puts "Published message: #{message} to service: #{service}" if store.publish(service, message)
  end
end