From 25a4155257cd463355bccb4330b0280e4110de9e Mon Sep 17 00:00:00 2001 From: Jerry D'Antonio Date: Sat, 15 Aug 2015 23:41:33 -0400 Subject: Initial implementation of ActiveJob AsyncAdapter. --- .../lib/active_job/queue_adapters/async_adapter.rb | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 activejob/lib/active_job/queue_adapters/async_adapter.rb (limited to 'activejob/lib/active_job/queue_adapters/async_adapter.rb') diff --git a/activejob/lib/active_job/queue_adapters/async_adapter.rb b/activejob/lib/active_job/queue_adapters/async_adapter.rb new file mode 100644 index 0000000000..3fc27f56e7 --- /dev/null +++ b/activejob/lib/active_job/queue_adapters/async_adapter.rb @@ -0,0 +1,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 -- cgit v1.2.3