Class: Handler::ResqueJob
- Inherits:
-
LanGrove::Handler::Base
- Object
- LanGrove::Handler::Base
- Handler::ResqueJob
- Defined in:
- lib/handler/resque_job.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_job.rb', line 5 def payload @payload end |
Class Method Details
.perform(*args) ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/handler/resque_job.rb', line 87 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
7 8 9 10 11 12 13 14 15 16 17 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 69 70 71 72 73 74 75 |
# File 'lib/handler/resque_job.rb', line 7 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 overridable start # start do_work # # Job was sent up the same assignment pipeline as # socket handler, # # It has therefore been assigned into the server's # @client collection # # It needs to be removed # I.notify( @logger, "need to disconnect from server here", [:vital] ) # # # stop end |
#stop_handler ⇒ Object
78 79 80 81 82 83 84 |
# File 'lib/handler/resque_job.rb', line 78 def stop_handler @root.trigger( self, :handler, :stop ) stop end |