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/queue_adapters/async_adapter.rb
2015-08-25 14:22:11 -04:00

23 lines
733 B
Ruby

require 'active_job/async_job'
module ActiveJob
module QueueAdapters
# == Active Job Async adapter
#
# When enqueueing jobs with the Async adapter the job will be executed
# asynchronously using {AsyncJob}[http://api.rubyonrails.org/classes/ActiveJob/AsyncJob.html].
#
# To use +AsyncJob+ set the queue_adapter config to +:async+.
#
# Rails.application.config.active_job.queue_adapter = :async
class AsyncAdapter
def enqueue(job) #:nodoc:
ActiveJob::AsyncJob.enqueue(job.serialize, queue: job.queue_name)
end
def enqueue_at(job, timestamp) #:nodoc:
ActiveJob::AsyncJob.enqueue_at(job.serialize, timestamp, queue: job.queue_name)
end
end
end
end