2014-05-19 17:01:56 -04:00
|
|
|
require 'queue_classic'
|
|
|
|
|
|
|
|
module ActiveJob
|
|
|
|
module QueueAdapters
|
|
|
|
class QueueClassicAdapter
|
|
|
|
class << self
|
2014-05-20 19:07:45 -04:00
|
|
|
def enqueue(job, *args)
|
2014-05-20 05:37:04 -04:00
|
|
|
QC::Queue.new(job.queue_name).enqueue("#{JobWrapper.name}.perform", job, *args)
|
2014-05-19 17:01:56 -04:00
|
|
|
end
|
2014-05-19 18:27:28 -04:00
|
|
|
|
2014-05-20 19:07:45 -04:00
|
|
|
def enqueue_at(job, timestamp, *args)
|
2014-05-19 18:27:28 -04:00
|
|
|
raise NotImplementedError
|
|
|
|
end
|
2014-05-19 17:01:56 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
class JobWrapper
|
|
|
|
def self.perform(job, *args)
|
2014-05-20 18:26:19 -04:00
|
|
|
job.new.perform_with_deserialization *args
|
2014-05-19 17:01:56 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|