Class: Rocketman::Relay::Redis
- Inherits:
-
Object
- Object
- Rocketman::Relay::Redis
- Includes:
- Producer
- Defined in:
- lib/rocketman/relay/redis.rb
Instance Method Summary collapse
-
#start(service) ⇒ Object
You should always pass in a new, dedicated connection to
Redis.
Methods included from Producer
Instance Method Details
#start(service) ⇒ Object
You should always pass in a new, dedicated connection to Redis. This is because redis.psubscribe will hog the whole Redis connection, thus if you pass in an existing Redis connection, you won’t be able to do anything with that connection anymore.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rocketman/relay/redis.rb', line 10 def start(service) puts "Rocketman> Using Redis as external producer".freeze if Rocketman.configuration.debug Thread.abort_on_exception = Rocketman.configuration.debug Thread.new do service.psubscribe("*") do |on| on. do |_pattern, event, payload| emit(event, payload) end end end end |