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-08-06 17:09:28 -04:00
|
|
|
QC::Queue.new(job.queue_name).enqueue("#{JobWrapper.name}.perform", job.name, *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
|
2014-08-19 06:29:39 -04:00
|
|
|
class << self
|
|
|
|
def perform(job_name, *args)
|
|
|
|
job_name.constantize.new.execute(*args)
|
|
|
|
end
|
2014-05-19 17:01:56 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|