aboutsummaryrefslogtreecommitdiffstats
path: root/lib/active_job/queue_adapters/queue_classic_adapter.rb
blob: d0e2e1aa22dd0f97b36e93d884b9f2fb6b85a7ef (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 'queue_classic'

module ActiveJob
  module QueueAdapters
    class QueueClassicAdapter
      class << self
        def queue(job, *args)
          QC::Queue.new(job.queue_name).enqueue("#{JobWrapper.name}.perform", job, *args)
        end

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

      class JobWrapper
        def self.perform(job, *args)
          job.new.perform *Parameters.deserialize(args)
        end
      end
    end
  end
end