Class: Kiyohime::Publisher
- Inherits:
-
Object
- Object
- Kiyohime::Publisher
- Defined in:
- lib/kiyohime/publisher.rb
Overview
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
Instance Attribute Summary collapse
-
#store ⇒ Object
readonly
Returns the value of attribute store.
Instance Method Summary collapse
-
#initialize(store = nil) ⇒ Publisher
constructor
Initialises the publisher by obtaining a Redis connection.
-
#publish(service, message) ⇒ Object
A message can be published to a service/function, a message can be a simple type, or at present a JSON compliant type.
Constructor Details
Instance Attribute Details
#store ⇒ Object (readonly)
Returns the value of attribute store.
8 9 10 |
# File 'lib/kiyohime/publisher.rb', line 8 def store @store end |
Instance Method Details
#publish(service, message) ⇒ Object
A message can be published to a service/function, a message can be a simple type, or at present a JSON compliant type
17 18 19 20 21 |
# File 'lib/kiyohime/publisher.rb', line 17 def publish(service, ) if store puts "Published message: #{} to service: #{service}" if store.publish(service, ) end end |