blob: 3fc27f56e7ef7129b8264e6bd27258634ca19931 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
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
|