Class: Workling::Invokers::LoopedSubscriber
- Defined in:
- lib/workling/invokers/looped_subscriber.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(routing, client_class) ⇒ LoopedSubscriber
constructor
A new instance of LoopedSubscriber.
-
#listen ⇒ Object
Starts EM loop and sets up subscription callbacks for workers.
- #stop ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(routing, client_class) ⇒ LoopedSubscriber
Returns a new instance of LoopedSubscriber.
8 9 10 |
# File 'lib/workling/invokers/looped_subscriber.rb', line 8 def initialize(routing, client_class) super end |
Instance Method Details
#listen ⇒ Object
Starts EM loop and sets up subscription callbacks for workers.
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/workling/invokers/looped_subscriber.rb', line 15 def listen connect do routes.each do |route| @client.subscribe(route) do |args| run(route, args) end end loop do sleep 1 end end end |
#stop ⇒ Object
29 30 31 |
# File 'lib/workling/invokers/looped_subscriber.rb', line 29 def stop end |