Module: ActiveJob

Extended by:
ActiveSupport::Autoload
Defined in:
lib/active_job.rb,
lib/active_job/base.rb,
lib/active_job/core.rb,
lib/active_job/logging.rb,
lib/active_job/railtie.rb,
lib/active_job/version.rb,
lib/active_job/arguments.rb,
lib/active_job/callbacks.rb,
lib/active_job/enqueuing.rb,
lib/active_job/execution.rb,
lib/active_job/test_case.rb,
lib/active_job/timezones.rb,
lib/active_job/deprecator.rb,
lib/active_job/exceptions.rb,
lib/active_job/queue_name.rb,
lib/active_job/gem_version.rb,
lib/active_job/serializers.rb,
lib/active_job/test_helper.rb,
lib/active_job/translation.rb,
lib/active_job/queue_adapter.rb,
lib/active_job/configured_job.rb,
lib/active_job/log_subscriber.rb,
lib/active_job/queue_adapters.rb,
lib/active_job/queue_priority.rb,
lib/active_job/instrumentation.rb,
lib/active_job/queue_adapters/test_adapter.rb,
lib/active_job/serializers/date_serializer.rb,
lib/active_job/serializers/time_serializer.rb,
lib/active_job/queue_adapters/async_adapter.rb,
lib/active_job/serializers/range_serializer.rb,
lib/active_job/queue_adapters/inline_adapter.rb,
lib/active_job/queue_adapters/resque_adapter.rb,
lib/active_job/serializers/module_serializer.rb,
lib/active_job/serializers/object_serializer.rb,
lib/active_job/serializers/symbol_serializer.rb,
lib/active_job/queue_adapters/sidekiq_adapter.rb,
lib/active_job/queue_adapters/abstract_adapter.rb,
lib/active_job/queue_adapters/sneakers_adapter.rb,
lib/active_job/serializers/duration_serializer.rb,
lib/active_job/enqueue_after_transaction_commit.rb,
lib/active_job/serializers/date_time_serializer.rb,
lib/active_job/queue_adapters/backburner_adapter.rb,
lib/active_job/queue_adapters/delayed_job_adapter.rb,
lib/active_job/serializers/big_decimal_serializer.rb,
lib/active_job/serializers/time_object_serializer.rb,
lib/active_job/queue_adapters/sucker_punch_adapter.rb,
lib/active_job/queue_adapters/queue_classic_adapter.rb,
lib/active_job/serializers/time_with_zone_serializer.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Arguments, Callbacks, Core, EnqueueAfterTransactionCommit, Enqueuing, Exceptions, Execution, Instrumentation, Logging, QueueAdapter, QueueAdapters, QueueName, QueuePriority, Serializers, TestHelper, Timezones, Translation, VERSION Classes: Base, ConfiguredJob, DeserializationError, EnqueueError, LogSubscriber, Railtie, SerializationError, TestCase

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#verbose_enqueue_logsObject

:singleton-method: verbose_enqueue_logs

Specifies if the methods calling background job enqueue should be logged below their relevant enqueue log lines. Defaults to false.



69
70
71
# File 'lib/active_job.rb', line 69

def verbose_enqueue_logs
  @verbose_enqueue_logs
end

Class Method Details

.adapter_name(adapter) ⇒ Object

:nodoc:



7
8
9
10
11
12
# File 'lib/active_job/queue_adapter.rb', line 7

def adapter_name(adapter) # :nodoc:
  return adapter.queue_adapter_name if adapter.respond_to?(:queue_adapter_name)

  adapter_class = adapter.is_a?(Module) ? adapter : adapter.class
  "#{adapter_class.name.demodulize.delete_suffix('Adapter')}"
end

.deprecatorObject

:nodoc:



4
5
6
# File 'lib/active_job/deprecator.rb', line 4

def self.deprecator # :nodoc:
  @deprecator ||= ActiveSupport::Deprecation.new
end

.gem_versionObject

Returns the currently loaded version of Active Job as a Gem::Version.



5
6
7
# File 'lib/active_job/gem_version.rb', line 5

def self.gem_version
  Gem::Version.new VERSION::STRING
end

.perform_all_later(*jobs) ⇒ Object

Push many jobs onto the queue at once without running enqueue callbacks. Queue adapters may communicate the enqueue status of each job by setting successfully_enqueued and/or enqueue_error on the passed-in job instances.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/active_job/enqueuing.rb', line 14

def perform_all_later(*jobs)
  jobs.flatten!
  jobs.group_by(&:queue_adapter).each do |queue_adapter, adapter_jobs|
    instrument_enqueue_all(queue_adapter, adapter_jobs) do
      if queue_adapter.respond_to?(:enqueue_all)
        queue_adapter.enqueue_all(adapter_jobs)
      else
        adapter_jobs.each do |job|
          job.successfully_enqueued = false
          if job.scheduled_at
            queue_adapter.enqueue_at(job, job.scheduled_at.to_f)
          else
            queue_adapter.enqueue(job)
          end
          job.successfully_enqueued = true
        rescue EnqueueError => e
          job.enqueue_error = e
        end
        adapter_jobs.count(&:successfully_enqueued?)
      end
    end
  end
  nil
end

.use_big_decimal_serializerObject



52
53
54
55
56
# File 'lib/active_job.rb', line 52

def self.use_big_decimal_serializer
  ActiveJob.deprecator.warn <<-WARNING.squish
    Rails.application.config.active_job.use_big_decimal_serializer is deprecated and will be removed in Rails 8.0.
  WARNING
end

.use_big_decimal_serializer=(value) ⇒ Object



58
59
60
61
62
# File 'lib/active_job.rb', line 58

def self.use_big_decimal_serializer=(value)
  ActiveJob.deprecator.warn <<-WARNING.squish
    Rails.application.config.active_job.use_big_decimal_serializer is deprecated and will be removed in Rails 8.0.
  WARNING
end

.versionObject

Returns the currently loaded version of Active Job as a Gem::Version.



7
8
9
# File 'lib/active_job/version.rb', line 7

def self.version
  gem_version
end