Class: Wurk::Batch::CallbackJob

Inherits:
Object
  • Object
show all
Includes:
Job
Defined in:
lib/wurk/batch/callback_job.rb

Overview

Worker that runs a single batch callback. Target may be a Class name (“MyCallback” → ‘MyCallback.new.on_<event>(status, options)`) or a “Klass#method” spec (“Foo#bar” → `Foo.new.bar(status, options)`). Failures retry like any ordinary job — callbacks MUST be idempotent.

Spec: docs/target/sidekiq-pro.md §2.4.

Instance Method Summary collapse

Methods included from Job

clear_all, drain_all, included, jobs

Instance Method Details

#perform(bid, target_spec, event, options) ⇒ Object



18
19
20
21
22
23
# File 'lib/wurk/batch/callback_job.rb', line 18

def perform(bid, target_spec, event, options)
  klass, method = resolve(target_spec, event)
  instance = klass.new
  status   = Wurk::Batch::Status.new(bid)
  instance.public_send(method, status, options || {})
end