Reputation: 11896
Does anyone know a working background job solution for JRuby deployed on a windows server? (via warbler and tomcat)
I'm looking for a way to schedule background jobs from my Rails 3.2 app, so that the web app can respond immediately rather than hang up while a long running job runs.
I tried the delayed_job gem, except it doesn't seem to work with JRuby and Windows. (If I'm wrong, please enlighten me) Resque depends on redis which evidently doesn't support Windows. I don't have experience with Beanstalkd or Starling, but the documentation for them doesn't mention windows.
I'ld love to dump windows, believe me, but the background job is a windows executable that did not come with source. And I need to use JRuby to be able to call some Java code too.
Upvotes: 3
Views: 1807
Reputation: 11896
Solved the problem using the jruby-rack-worker gem, http://github.com/kares/jruby-rack-worker, which let's you use delayed_job to schedule jobs, just provides a different way to kickoff worker processes that is more JRuby/Warbler/Tomcat friendly.
Upvotes: 4
Reputation: 6444
We use Rufus Scheduler for that purpose. The scheduler configuration sits in an initializer file like so:
scheduler = Rufus::Scheduler.start_new
scheduler.every('1d') do
puts "I run once every day"
end
scheduler.every '3h' do
puts "I run every 3 hours"
end
Upvotes: 3