lib/cloudist/worker.rb in cloudist-0.2.1 vs lib/cloudist/worker.rb in cloudist-0.4.1
- old
+ new
@@ -1,19 +1,26 @@
module Cloudist
class Worker
- attr_reader :job, :queue
+ attr_reader :job, :queue, :payload
def initialize(job, queue)
- @job, @queue = job, queue
+ @job, @queue, @payload = job, queue, job.payload
+
+ # Do custom initialization
+ self.setup if self.respond_to?(:setup)
end
def data
job.data
end
def headers
job.headers
+ end
+
+ def id
+ job.id
end
def process
raise NotImplementedError, "Your worker class must subclass this method"
end