Class: Workling::Remote::Invokers::BasicPoller

Inherits:
Base
  • Object
show all
Defined in:
lib/workling/remote/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



14
15
16
# File 'lib/workling/remote/invokers/basic_poller.rb', line 14

def initialize(routing, client_class)
  super
end

Instance Method Details

#listenObject

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



21
22
23
24
25
26
27
28
29
# File 'lib/workling/remote/invokers/basic_poller.rb', line 21

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.


35
36
37
# File 'lib/workling/remote/invokers/basic_poller.rb', line 35

def stop
  @shutdown = true
end