1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activejob/lib/active_job/base.rb

76 lines
2.1 KiB
Ruby
Raw Normal View History

2017-07-09 13:49:52 -04:00
# frozen_string_literal: true
require "active_job/core"
require "active_job/queue_adapter"
require "active_job/queue_name"
require "active_job/queue_priority"
require "active_job/enqueuing"
require "active_job/execution"
require "active_job/callbacks"
require "active_job/exceptions"
require "active_job/logging"
require "active_job/translation"
2014-05-18 06:32:22 -04:00
module ActiveJob #:nodoc:
# = Active Job
#
# Active Job objects can be configured to work with different backend
# queuing frameworks. To specify a queue adapter to use:
#
# ActiveJob::Base.queue_adapter = :inline
#
# A list of supported adapters can be found in QueueAdapters.
#
# Active Job objects can be defined by creating a class that inherits
# from the ActiveJob::Base class. The only necessary method to
# implement is the "perform" method.
#
# To define an Active Job object:
#
# class ProcessPhotoJob < ActiveJob::Base
# def perform(photo)
# photo.watermark!('Rails')
# photo.rotate!(90.degrees)
# photo.resize_to_fit!(300, 300)
# photo.upload!
# end
# end
#
# Records that are passed in are serialized/deserialized using Global
# ID. More information can be found in Arguments.
#
2015-11-08 20:38:13 -05:00
# To enqueue a job to be performed as soon as the queueing system is free:
#
# ProcessPhotoJob.perform_later(photo)
#
# To enqueue a job to be processed at some point in the future:
#
# ProcessPhotoJob.set(wait_until: Date.tomorrow.noon).perform_later(photo)
#
# More information can be found in ActiveJob::Core::ClassMethods#set
#
# A job can also be processed immediately without sending to the queue:
#
# ProcessPhotoJob.perform_now(photo)
#
# == Exceptions
#
# * DeserializationError - Error class for deserialization errors.
# * SerializationError - Error class for serialization errors.
2014-05-18 05:44:28 -04:00
class Base
2014-08-25 10:34:50 -04:00
include Core
2017-10-17 08:05:05 -04:00
include Serializers
2014-08-26 16:08:49 -04:00
include QueueAdapter
include QueueName
2015-03-18 05:48:26 -04:00
include QueuePriority
include Enqueuing
include Execution
include Callbacks
include Exceptions
include Logging
include Translation
2014-05-21 17:10:17 -04:00
ActiveSupport.run_load_hooks(:active_job, self)
2014-05-18 05:44:28 -04:00
end
2014-05-20 07:41:14 -04:00
end