aboutsummaryrefslogtreecommitdiffstats
path: root/lib/active_job/enqueuing.rb
blob: 61734fdfb6c73fe96a16b1ee014de24e1dc6ce28 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'active_job/parameters'

module ActiveJob
  module Enqueuing
    # Push a job onto the queue.  The arguments must be legal JSON types
    # (string, int, float, nil, true, false, hash or array) or
    # ActiveModel::GlobalIdentication instances.  Arbitrary Ruby objects
    # are not supported.
    #
    # The return value is adapter-specific and may change in a future
    # ActiveJob release.
    def enqueue(*args)
      serialized_args = Parameters.serialize(args)
      ActiveSupport::Notifications.instrument "enqueue.active_job", adapter: queue_adapter, job: self, args: serialized_args
      queue_adapter.queue self, *serialized_args
    end
  end
end