Method: ActiveJob::Callbacks::ClassMethods#after_enqueue

Defined in:
activejob/lib/active_job/callbacks.rb

#after_enqueue(*filters, &blk) ⇒ Object

Defines a callback that will get called right after the job is enqueued.

class VideoProcessJob < ActiveJob::Base
  queue_as :default

  after_enqueue do |job|
    $statsd.increment "enqueue-video-job.success"
  end

  def perform(video_id)
    Video.find(video_id).process
  end
end


142
143
144
# File 'activejob/lib/active_job/callbacks.rb', line 142

def after_enqueue(*filters, &blk)
  set_callback(:enqueue, :after, *filters, &blk)
end