Class: Handler::ResqueHandler
- Inherits:
-
LanGrove::Handler::Deferred
- Object
- LanGrove::Handler::Deferred
- Handler::ResqueHandler
- Defined in:
- lib/handler/resque_handler.rb
Instance Attribute Summary collapse
-
#payload ⇒ Object
Returns the value of attribute payload.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#payload ⇒ Object
Returns the value of attribute payload.
5 6 7 |
# File 'lib/handler/resque_handler.rb', line 5 def payload @payload end |
Class Method Details
.perform(*args) ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/handler/resque_handler.rb', line 80 def self.perform( *args ) # # Does not do the job, serves only to collect # the payload and yield into the local runtime # via the ResqueAdaptor, # # Requeue jobs are marked as failed unless this # is present. # end |
Instance Method Details
#start_handler ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/handler/resque_handler.rb', line 18 def start_handler # # Trigger the handler_start event # @root.trigger( self, :handler, :start ) # # The job payload header may define an :action # to perform, # unless payload['args'][0]['action'].nil? unless self.respond_to?( payload['args'][0]['action'].to_sym ) # # local handler does not define that action # bring the house down # raise LanGrove::DaemonConfigException( "#{self.class}.#{payload[0]['action']}() not defined. Required by payload header: #{payload[0].inspect} " ) end # # Should the header :action return false, # unless self.send( payload['args'][0]['action'].to_sym ) # # Then the job will be skipped. # @logger.debug "#{self.class} job SKIPPED" return end end # # Call implementor overridables # start work end |
#stop_handler ⇒ Object
71 72 73 74 75 76 77 |
# File 'lib/handler/resque_handler.rb', line 71 def stop_handler @root.trigger( self, :handler, :stop ) stop end |
#work ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/handler/resque_handler.rb', line 7 def work # # OVERRIDE # # To do the Job (payload in @capsule) # end |