diff options
Diffstat (limited to 'lib/active_job/queue_adapters/backburner_adapter.rb')
-rw-r--r-- | lib/active_job/queue_adapters/backburner_adapter.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/active_job/queue_adapters/backburner_adapter.rb b/lib/active_job/queue_adapters/backburner_adapter.rb new file mode 100644 index 0000000000..0d023d9ee7 --- /dev/null +++ b/lib/active_job/queue_adapters/backburner_adapter.rb @@ -0,0 +1,25 @@ +require 'backburner' + +module ActiveJob + module QueueAdapters + class BackburnerAdapter + class << self + def queue(job, *args) + Backburner::Worker.enqueue JobWrapper, [ job.name, *args ], queue: job.queue_name + end + + def queue_at(job, timestamp, *args) + raise NotImplementedError + end + end + + class JobWrapper + class << self + def perform(job_name, *args) + job_name.constantize.new.perform *Parameters.deserialize(args) + end + end + end + end + end +end |