Closed glappen closed 4 years ago
Answered my own question - it works!
I made a rake task with the following:
namespace :worker do
desc "run delayed job and sneakers workers"
task work: :environment do
threads = []
threads << Thread.new do
Delayed::Worker.new.start
end
threads << Thread.new do
Sneakers::Runner.new([MeetingSyncWorker]).run
end
threads.each { |thr| thr.join }
end
end
Hi, I have bunch of rails applications that are using RabbitMQ and Sneakers already for communication. One of the applications needs to run a Sneakers Worker to consume messages, but it was already written to use Delayed Job for scheduling jobs to run at some time in the future. I first attempted to use Sneakers for ActiveJob, but ran into the issue that the sneakers backend does not support scheduling jobs. But I don't want to have both a delayed job worker process running in addition to a sneakers worker process running. Is there a way to combine them into one process? Could I make my own worker script that kicks off both Delayed Job and Sneakers in their own threads? I saw this link:
https://github.com/jondot/sneakers/wiki/Running-With-Sneakers
It seems I would need to start the Sneakers::Runner in it's own thread - would that work with delayed job running in another thread?
Thanks!
Greg