Sunday, 20 November 2016

Web-interface for Resque's worker with resque-web

In previous blog we have implemented background job with Resque. Now we will implement web interface for these background workers.

For this we will use resque-web gem. Resque’s web interface is a great way to get a high-level understanding of your background workers, and its pluggable design has made it easy for others to contribute a number of really useful plugins.

So, in Gemfile -

gem 'resque-web',


Now, mount it in your config/routes.rb -

require "resque_web"

MyApp::Application.routes.draw do
  mount Resque::Server.new, at: "/resque"
end

In almost cases we certainly want to limit access when using resque-web in production. We can achieve this with routes constraints. Here we are allow access only to admin user.

So, edit your routes.rb - 

authenticate :admin_user do
    mount Resque::Server.new, :at => '/resque'
 end

Now, we have done with resque-web configuration. So,restart your Rails server.
Open up

http://localhost:3000/resque
in a browser to check out the web backend.


On the Overview tab you can see a list of the queues and workers. Each queue shows a count of pending jobs. The list of workers displays what queue(s) each worker is working on, and the job currently being processed (if any).

No comments:

Post a Comment