Class: Workling::Invokers::BasicPoller

Inherits:
Base
  • Object
show all
Defined in:
lib/workling/invokers/basic_poller.rb

Instance Attribute Summary

Attributes inherited from Base

#reset_time, #sleep_time

Instance Method Summary collapse

Methods inherited from Base

#logger, #run

Constructor Details

#initialize(routing, client_class) ⇒ BasicPoller

set up client, sleep time



11
12
13
# File 'lib/workling/invokers/basic_poller.rb', line 11

def initialize(routing, client_class)
  super
end

Instance Method Details

#listenObject

Starts main Invoker Loop. The invoker runs until stop() is called.



18
19
20
21
22
23
24
25
26
# File 'lib/workling/invokers/basic_poller.rb', line 18

def listen
  connect do
    loop_routes do |route|
      if args = @client.retrieve(route)
        run(route, args)
      end
    end
  end
end

#stopObject

Gracefully stops the Invoker. The currently executing Jobs should be allowed

to finish.


32
33
34
# File 'lib/workling/invokers/basic_poller.rb', line 32

def stop
  @shutdown = true
end