2014-08-26 08:22:59 -04:00
|
|
|
module ActiveJob
|
2014-09-21 16:20:23 -04:00
|
|
|
# == Active Job adapters
|
|
|
|
#
|
|
|
|
# Active Job has adapters for the following queueing backends:
|
|
|
|
#
|
|
|
|
# * {Backburner}[https://github.com/nesquena/backburner]
|
|
|
|
# * {Delayed Job}[https://github.com/collectiveidea/delayed_job]
|
|
|
|
# * {Qu}[https://github.com/bkeepers/qu]
|
|
|
|
# * {Que}[https://github.com/chanks/que]
|
2014-10-06 11:58:45 -04:00
|
|
|
# * {queue_classic}[https://github.com/QueueClassic/queue_classic]
|
2014-09-21 16:20:23 -04:00
|
|
|
# * {Resque 1.x}[https://github.com/resque/resque/tree/1-x-stable]
|
|
|
|
# * {Sidekiq}[http://sidekiq.org]
|
|
|
|
# * {Sneakers}[https://github.com/jondot/sneakers]
|
|
|
|
# * {Sucker Punch}[https://github.com/brandonhilkert/sucker_punch]
|
|
|
|
#
|
2014-11-02 06:32:50 -05:00
|
|
|
# === Backends Features
|
2014-09-21 16:20:23 -04:00
|
|
|
#
|
|
|
|
# | | Async | Queues | Delayed | Priorities | Timeout | Retries |
|
|
|
|
# |-------------------|-------|--------|-----------|------------|---------|---------|
|
|
|
|
# | Backburner | Yes | Yes | Yes | Yes | Job | Global |
|
|
|
|
# | Delayed Job | Yes | Yes | Yes | Job | Global | Global |
|
2014-11-14 23:48:03 -05:00
|
|
|
# | Qu | Yes | Yes | No | No | No | Global |
|
2014-09-21 16:20:23 -04:00
|
|
|
# | Que | Yes | Yes | Yes | Job | No | Job |
|
2014-10-06 11:58:45 -04:00
|
|
|
# | queue_classic | Yes | Yes | No* | No | No | No |
|
2014-09-21 16:20:23 -04:00
|
|
|
# | Resque | Yes | Yes | Yes (Gem) | Queue | Global | Yes |
|
|
|
|
# | Sidekiq | Yes | Yes | Yes | Queue | No | Job |
|
|
|
|
# | Sneakers | Yes | Yes | No | Queue | Queue | No |
|
|
|
|
# | Sucker Punch | Yes | Yes | No | No | No | No |
|
|
|
|
# | Active Job Inline | No | Yes | N/A | N/A | N/A | N/A |
|
|
|
|
#
|
2015-04-09 16:14:23 -04:00
|
|
|
# ==== Async
|
2015-04-06 17:42:13 -04:00
|
|
|
#
|
2015-04-09 16:14:23 -04:00
|
|
|
# Yes: The Queue Adapter runs the jobs in a separate or forked process.
|
2015-04-06 17:42:13 -04:00
|
|
|
#
|
2015-04-09 16:14:23 -04:00
|
|
|
# No: The job is run in the same process.
|
2015-04-06 17:42:13 -04:00
|
|
|
#
|
2015-04-09 16:14:23 -04:00
|
|
|
# ==== Queues
|
2015-04-06 17:42:13 -04:00
|
|
|
#
|
2015-04-12 09:33:33 -04:00
|
|
|
# Yes: Jobs may set which queue they are run in with queue_as or by using the set
|
|
|
|
# method.
|
2015-04-06 17:42:13 -04:00
|
|
|
#
|
2015-04-09 16:14:23 -04:00
|
|
|
# ==== Delayed
|
2015-04-06 17:42:13 -04:00
|
|
|
#
|
2015-04-10 19:37:25 -04:00
|
|
|
# Yes: The adapter will run the job in the future through perform_later.
|
2015-04-06 17:42:13 -04:00
|
|
|
#
|
2015-04-09 16:14:23 -04:00
|
|
|
# (Gem): An additional gem is required to use perform_later with this adapter.
|
2015-04-06 17:42:13 -04:00
|
|
|
#
|
2015-04-10 19:37:25 -04:00
|
|
|
# No: The adapter will run jobs at the next opportunity and cannot use perform_later.
|
2015-04-09 16:14:23 -04:00
|
|
|
#
|
2015-04-10 19:37:25 -04:00
|
|
|
# N/A: The adapter does not support queueing.
|
2015-04-06 17:42:13 -04:00
|
|
|
#
|
2014-09-21 16:20:23 -04:00
|
|
|
# NOTE:
|
2015-04-10 19:37:25 -04:00
|
|
|
# queue_classic does not support job scheduling.
|
|
|
|
# However, you can use the queue_classic-later gem.
|
|
|
|
# See the documentation for ActiveJob::QueueAdapters::QueueClassicAdapter.
|
2014-09-21 16:20:23 -04:00
|
|
|
#
|
2015-04-09 16:14:23 -04:00
|
|
|
# ==== Priorities
|
|
|
|
#
|
2015-04-12 09:33:33 -04:00
|
|
|
# The order in which jobs are processed can be configured differently depending
|
|
|
|
# on the adapter.
|
2015-04-09 16:14:23 -04:00
|
|
|
#
|
2015-04-12 09:33:33 -04:00
|
|
|
# Job: Any class inheriting from the adapter may set the priority on the job
|
|
|
|
# object relative to other jobs.
|
2015-04-09 16:14:23 -04:00
|
|
|
#
|
2015-04-12 09:33:33 -04:00
|
|
|
# Queue: The adapter can set the priority for job queues, when setting a queue
|
|
|
|
# with Active Job this will be respected.
|
2015-04-09 16:14:23 -04:00
|
|
|
#
|
2015-04-12 09:33:33 -04:00
|
|
|
# Yes: Allows the priority to be set on the job object, at the queue level or
|
|
|
|
# as default configuration option.
|
2015-04-09 16:14:23 -04:00
|
|
|
#
|
|
|
|
# No: Does not allow the priority of jobs to be configured.
|
|
|
|
#
|
2015-04-10 19:37:25 -04:00
|
|
|
# N/A: The adapter does not support queueing, and therefore sorting them.
|
2015-04-09 16:14:23 -04:00
|
|
|
#
|
|
|
|
# ==== Timeout
|
|
|
|
#
|
2015-04-10 19:37:25 -04:00
|
|
|
# When a job will stop after the allotted time.
|
2015-04-09 16:14:23 -04:00
|
|
|
#
|
2015-04-10 19:37:25 -04:00
|
|
|
# Job: The timeout can be set for each instance of the job class.
|
2015-04-09 16:14:23 -04:00
|
|
|
#
|
2015-04-10 19:37:25 -04:00
|
|
|
# Queue: The timeout is set for all jobs on the queue.
|
2015-04-09 16:14:23 -04:00
|
|
|
#
|
|
|
|
# Global: The adapter is configured that all jobs have a maximum run time.
|
|
|
|
#
|
2015-04-12 09:33:33 -04:00
|
|
|
# N/A: This adapter does not run in a separate process, and therefore timeout
|
|
|
|
# is unsupported.
|
2015-04-09 16:14:23 -04:00
|
|
|
#
|
|
|
|
# ==== Retries
|
|
|
|
#
|
|
|
|
# Job: The number of retries can be set per instance of the job class.
|
|
|
|
#
|
2015-04-12 09:33:33 -04:00
|
|
|
# Yes: The Number of retries can be configured globally, for each instance or
|
|
|
|
# on the queue. This adapter may also present failed instances of the job class
|
|
|
|
# that can be restarted.
|
2015-04-09 16:14:23 -04:00
|
|
|
#
|
|
|
|
# Global: The adapter has a global number of retries.
|
2015-04-10 19:37:25 -04:00
|
|
|
#
|
2015-04-12 09:33:33 -04:00
|
|
|
# N/A: The adapter does not run in a separate process, and therefore doesn't
|
|
|
|
# support retries.
|
2014-08-26 08:22:59 -04:00
|
|
|
module QueueAdapters
|
|
|
|
extend ActiveSupport::Autoload
|
|
|
|
|
|
|
|
autoload :InlineAdapter
|
|
|
|
autoload :BackburnerAdapter
|
|
|
|
autoload :DelayedJobAdapter
|
|
|
|
autoload :QuAdapter
|
|
|
|
autoload :QueAdapter
|
|
|
|
autoload :QueueClassicAdapter
|
|
|
|
autoload :ResqueAdapter
|
|
|
|
autoload :SidekiqAdapter
|
|
|
|
autoload :SneakersAdapter
|
|
|
|
autoload :SuckerPunchAdapter
|
2014-08-26 16:08:49 -04:00
|
|
|
autoload :TestAdapter
|
2015-03-12 13:28:16 -04:00
|
|
|
|
|
|
|
ADAPTER = 'Adapter'.freeze
|
2015-03-16 03:52:44 -04:00
|
|
|
private_constant :ADAPTER
|
2015-03-12 13:28:16 -04:00
|
|
|
|
|
|
|
class << self
|
|
|
|
def lookup(name)
|
|
|
|
const_get(name.to_s.camelize << ADAPTER)
|
|
|
|
end
|
|
|
|
end
|
2014-08-26 08:22:59 -04:00
|
|
|
end
|
|
|
|
end
|