Class: WideReceiver::Adapters::RedisAdapter
- Inherits:
-
Object
- Object
- WideReceiver::Adapters::RedisAdapter
- Defined in:
- lib/wide_receiver/adapters/redis_adapter.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#input ⇒ Object
readonly
Returns the value of attribute input.
Instance Method Summary collapse
-
#initialize(channel, workers, config: Config.instance) ⇒ RedisAdapter
constructor
A new instance of RedisAdapter.
- #work ⇒ Object
Constructor Details
#initialize(channel, workers, config: Config.instance) ⇒ RedisAdapter
Returns a new instance of RedisAdapter.
12 13 14 15 16 17 18 19 |
# File 'lib/wide_receiver/adapters/redis_adapter.rb', line 12 def initialize(channel, workers, config: Config.instance) @pattern = channel @workers = workers.map { |w| Object.const_get(w) } @config = config @input = redis_connection @error = Redis::Namespace.new(:wide_receiver, redis: redis_connection) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/wide_receiver/adapters/redis_adapter.rb', line 10 def config @config end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
10 11 12 |
# File 'lib/wide_receiver/adapters/redis_adapter.rb', line 10 def error @error end |
#input ⇒ Object (readonly)
Returns the value of attribute input.
10 11 12 |
# File 'lib/wide_receiver/adapters/redis_adapter.rb', line 10 def input @input end |
Instance Method Details
#work ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/wide_receiver/adapters/redis_adapter.rb', line 21 def work @input.psubscribe(@pattern) do |on| on. do |pattern, channel, | send_workers channel, processed() end end end |