aboutsummaryrefslogblamecommitdiffstats
path: root/activejob/lib/active_job/queue_adapters/backburner_adapter.rb
blob: 6fe2d4eb53ae5ecfdebffb8dc08eb8d1a0cf0537 (plain) (tree)
1
2
3
4
5
6
7
8
9





                           
                               

                                                                                           
 
                                             

                                   
         



                                      
                                                   





             
require 'backburner'

module ActiveJob
  module QueueAdapters
    class BackburnerAdapter
      class << self
        def enqueue(job, *args)
          Backburner::Worker.enqueue JobWrapper, [ job.name, *args ], queue: job.queue_name
        end

        def enqueue_at(job, timestamp, *args)
          raise NotImplementedError
        end
      end

      class JobWrapper
        class << self
          def perform(job_name, *args)
            job_name.constantize.new.execute(*args)
          end
        end
      end
    end
  end
end