Class: Queuel::Base::Poller

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/queuel/base/poller.rb

Direct Known Subclasses

IronMq::Poller, Null::Poller, SQS::Poller

Instance Method Summary collapse

Constructor Details

#initialize(queue, param_block, options = {}, workers = 1) ⇒ Poller

Returns a new instance of Poller.



10
11
12
13
14
15
16
17
18
19
# File 'lib/queuel/base/poller.rb', line 10

def initialize(queue, param_block, options = {}, workers = 1)
  self.workers = workers
  self.queue = queue
  self.options = options || {}
  self.inst_block = param_block
  self.tries = 0
  self.continue_looping = true
  self.pool_tasks = 0
  self.mutex = Mutex.new
end

Instance Method Details

#pollObject



21
22
23
24
25
26
27
28
29
# File 'lib/queuel/base/poller.rb', line 21

def poll
  register_trappers
  logger.debug("Beginning Poll...")
  self.master = master_thread
  log_action(:joining, :master) { master.join }
rescue SignalException => e
  logger.warn "Caught (#{e}), shutting Poller down"
  log_action(:killing, :poller, :warn) { shutdown }
end