Versatile async database based jobs for rails.
We did this gem to:
- Avoid the need to install another admin interface.
- Simplify the job api by having close integration to rails.
- Using sql instead of redis to never lose jobs.
Put this line in your Gemfile:
gem 'sidejobs'
Then bundle:
$ bundle
Generate the sidejobs configuration and migration file:
$ bundle exec rails g sidejobs:install
Set the global settings:
Sidejobs.configure do |config|
config.max_attempts = 3
config.sleep_delay = 15
config.batch_size = 20
end
Run the migration to create the sidejobs table:
$ bundle exec rake db:migrate
Assign the sidejobs adapter to the environments:
Rails.application.configure do
config.active_job.queue_adapter = :sidejobs
end
To control the daemon, use the rake tasks:
$ bundle exec rake sidejobs:start
$ bundle exec rake sidejobs:stop
$ bundle exec rake sidejobs:restart
You can deliver mails using deliver_later:
UserMailer.invite('[email protected]').deliver_later
Or perform jobs using perform_later:
SendNewsletterJob.perform_later
No admin interface, all is done using Sidejobs::Job model:
Sidejobs::Job.failing.where('attempts > ?', 3).destroy_all
Any issue, pull request, comment of any kind is more than welcome!
We will mainly ensure compatibility to last versions of Ruby, Rails and PostgreSQL.
This gem is maintained and funded by museways.
It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.