123456789_123456789_123456789_123456789_123456789_

Module: ActiveJob

Relationships & Source Files
Namespace Children
Modules:
Classes:
Exceptions:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Defined in: activejob/lib/active_job.rb,
activejob/lib/active_job/arguments.rb,
activejob/lib/active_job/base.rb,
activejob/lib/active_job/callbacks.rb,
activejob/lib/active_job/configured_job.rb,
activejob/lib/active_job/core.rb,
activejob/lib/active_job/deprecator.rb,
activejob/lib/active_job/enqueue_after_transaction_commit.rb,
activejob/lib/active_job/enqueuing.rb,
activejob/lib/active_job/exceptions.rb,
activejob/lib/active_job/execution.rb,
activejob/lib/active_job/gem_version.rb,
activejob/lib/active_job/instrumentation.rb,
activejob/lib/active_job/log_subscriber.rb,
activejob/lib/active_job/logging.rb,
activejob/lib/active_job/queue_adapter.rb,
activejob/lib/active_job/queue_adapters.rb,
activejob/lib/active_job/queue_name.rb,
activejob/lib/active_job/queue_priority.rb,
activejob/lib/active_job/railtie.rb,
activejob/lib/active_job/serializers.rb,
activejob/lib/active_job/test_case.rb,
activejob/lib/active_job/test_helper.rb,
activejob/lib/active_job/timezones.rb,
activejob/lib/active_job/translation.rb,
activejob/lib/active_job/version.rb,
activejob/lib/active_job/queue_adapters/abstract_adapter.rb,
activejob/lib/active_job/queue_adapters/async_adapter.rb,
activejob/lib/active_job/queue_adapters/backburner_adapter.rb,
activejob/lib/active_job/queue_adapters/delayed_job_adapter.rb,
activejob/lib/active_job/queue_adapters/inline_adapter.rb,
activejob/lib/active_job/queue_adapters/queue_classic_adapter.rb,
activejob/lib/active_job/queue_adapters/resque_adapter.rb,
activejob/lib/active_job/queue_adapters/sidekiq_adapter.rb,
activejob/lib/active_job/queue_adapters/sneakers_adapter.rb,
activejob/lib/active_job/queue_adapters/sucker_punch_adapter.rb,
activejob/lib/active_job/queue_adapters/test_adapter.rb,
activejob/lib/active_job/serializers/big_decimal_serializer.rb,
activejob/lib/active_job/serializers/date_serializer.rb,
activejob/lib/active_job/serializers/date_time_serializer.rb,
activejob/lib/active_job/serializers/duration_serializer.rb,
activejob/lib/active_job/serializers/module_serializer.rb,
activejob/lib/active_job/serializers/object_serializer.rb,
activejob/lib/active_job/serializers/range_serializer.rb,
activejob/lib/active_job/serializers/symbol_serializer.rb,
activejob/lib/active_job/serializers/time_object_serializer.rb,
activejob/lib/active_job/serializers/time_serializer.rb,
activejob/lib/active_job/serializers/time_with_zone_serializer.rb

Overview

:markup: markdown

Class Method Summary

::ActiveSupport::Autoload - Extended

Instance Attribute Summary

Class Method Details

.adapter_name(adapter)

This method is for internal use only.
[ GitHub ]

  
# File 'activejob/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

.deprecator

This method is for internal use only.
[ GitHub ]

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

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

.gem_version

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

[ GitHub ]

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

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

.instrument_enqueue_all(queue_adapter, jobs) (private)

[ GitHub ]

  
# File 'activejob/lib/active_job/instrumentation.rb', line 6

def instrument_enqueue_all(queue_adapter, jobs)
  payload = { adapter: queue_adapter, jobs: jobs }
  ActiveSupport::Notifications.instrument("enqueue_all.active_job", payload) do
    result = yield payload
    payload[:enqueued_count] = result
    result
  end
end

.perform_all_later(*jobs)

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.

[ GitHub ]

  
# File 'activejob/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

.verbose_enqueue_logs

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

[ GitHub ]

  
# File 'activejob/lib/active_job.rb', line 57

RDoc directive :singleton-method: verbose_enqueue_logs

.version

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

[ GitHub ]

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

def self.version
  gem_version
end

Instance Attribute Details

#verbose_enqueue_logs (rw)

[ GitHub ]

  
# File 'activejob/lib/active_job.rb', line 57

singleton_class.attr_accessor :verbose_enqueue_logs