diff options
author | Jerry D'Antonio <stumpjumper@gmail.com> | 2015-08-15 23:41:33 -0400 |
---|---|---|
committer | Jerry D'Antonio <stumpjumper@gmail.com> | 2015-08-25 14:22:11 -0400 |
commit | 25a4155257cd463355bccb4330b0280e4110de9e (patch) | |
tree | b58198818bb9ceadb4932e56f7c89c8b648ab4fb /activejob/lib/active_job/queue_adapters | |
parent | e6629257f4aecfa53fd1a1a2eae34aa33f637d79 (diff) | |
download | rails-25a4155257cd463355bccb4330b0280e4110de9e.tar.gz rails-25a4155257cd463355bccb4330b0280e4110de9e.tar.bz2 rails-25a4155257cd463355bccb4330b0280e4110de9e.zip |
Initial implementation of ActiveJob AsyncAdapter.
Diffstat (limited to 'activejob/lib/active_job/queue_adapters')
-rw-r--r-- | activejob/lib/active_job/queue_adapters/async_adapter.rb | 23 |
1 files changed, 23 insertions, 0 deletions
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 |