2014-05-22 13:33:23 -04:00
|
|
|
class CallbackJob < ActiveJob::Base
|
|
|
|
before_perform ->(job) { job.history << "CallbackJob ran before_perform" }
|
2014-10-21 02:07:40 -04:00
|
|
|
after_perform ->(job) { job.history << "CallbackJob ran after_perform" }
|
2014-05-22 13:33:23 -04:00
|
|
|
|
|
|
|
before_enqueue ->(job) { job.history << "CallbackJob ran before_enqueue" }
|
2014-10-21 02:07:40 -04:00
|
|
|
after_enqueue ->(job) { job.history << "CallbackJob ran after_enqueue" }
|
2014-05-22 13:33:23 -04:00
|
|
|
|
2014-10-21 02:07:40 -04:00
|
|
|
around_perform do |job, block|
|
|
|
|
job.history << "CallbackJob ran around_perform_start"
|
|
|
|
block.call
|
|
|
|
job.history << "CallbackJob ran around_perform_stop"
|
|
|
|
end
|
|
|
|
|
|
|
|
around_enqueue do |job, block|
|
|
|
|
job.history << "CallbackJob ran around_enqueue_start"
|
|
|
|
block.call
|
|
|
|
job.history << "CallbackJob ran around_enqueue_stop"
|
|
|
|
end
|
2014-05-22 13:33:23 -04:00
|
|
|
|
|
|
|
|
|
|
|
def perform(person = "david")
|
|
|
|
# NOTHING!
|
|
|
|
end
|
|
|
|
|
|
|
|
def history
|
|
|
|
@history ||= []
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|