Module: RMessage::Publisher
- Defined in:
- lib/rmessage/publisher.rb
Overview
A module to provide publishing functions to an Object.
Instance Attribute Summary collapse
-
#channel ⇒ String, ...
readonly
The channel to publish to.
Instance Method Summary collapse
-
#publish(message, channel: @channel, connection: nil, connection_index: 0) ⇒ Object
Publishes a message to the specified redis channel.
Instance Attribute Details
#channel ⇒ String, ... (readonly)
Returns the channel to publish to.
7 8 9 |
# File 'lib/rmessage/publisher.rb', line 7 def channel @channel end |
Instance Method Details
#publish(message, channel: @channel, connection: nil, connection_index: 0) ⇒ Object
Publishes a message to the specified redis channel.
13 14 15 16 |
# File 'lib/rmessage/publisher.rb', line 13 def publish(, channel: @channel, connection: nil, connection_index: 0) redis_connection = connection || RMessage::CONNECTION_POOL[connection_index] redis_connection.publish(channel, .build) end |