Rails Kitchen

It's a place to write on stuff I learned recently.

Delayed_job_web - a Resque Inspired Interface for Delayed_job

| Comments

delayed_job_web is a gem which will provide the Resque inspired interface for delayed_job. This gem will provide a nice interface for monitor all activities in delayed jobs instead of searching it in the database directly.
Some features:
  • Easily view jobs enqueued, working, pending, and failed.
  • Queue any single job. or all pending jobs, to run immediately.
  • Remove a failed job, or easily remove all failed jobs.
  • Watch delayed_job operation with live ajax polling.
  • Filter delayed_jobs by queue name.
Quick Start For Rails 5 Applications:

Add the dependency to your Gemfile and bundle it.
1
2
3
4
5
6
gem 'delayed_job_web'

# For dependency resolution of 'delayed_job_web' gem
# More info - https://github.com/ejschmitt/delayed_job_web/issues/84
gem 'rack-protection', github: 'sinatra/sinatra'
gem 'sinatra', github: 'sinatra/sinatra'

Add the following route to your application for accessing the interface, and retrying failed jobs.
1
2
3
get '/delayed_job' => DelayedJobWeb, :anchor => false
put '/delayed_job' => DelayedJobWeb, :anchor => false
post '/delayed_job' => DelayedJobWeb, :anchor => false
You can authenticate web interface by adding something like this,
1
2
3
4
5
authenticate :user, ->(u) { u.super_admin? } do
  get '/delayed_job' => DelayedJobWeb, :anchor => false
  put '/delayed_job' => DelayedJobWeb, :anchor => false
  post '/delayed_job' => DelayedJobWeb, :anchor => false
end
now web interface will be available only for super admin login.

Comments