Skip to content
fzf edited this page Nov 8, 2014 · 8 revisions

Resque ships with Redis and Airbrake failure backends.

Redis backends

Resque ships with two failure backends which can be controlled by setting the FAILURE_BACKEND environment variable (or Resque.config.failure_backend on Resque 2.0) to the given string:

  • 'redis': (default) this creates a single 'failure' queue within Redis in which all failures from all jobs are placed, regardless of which queue the job originated from.
  • 'redis_multi_queue': creates a separate failure queue per job queue. Especially useful if you have a large number of job queues and want a way to individually track failures on a queue-by-queue basis

In version 1.x you can enable multi_queue by adding this to your config/initializers/resque.rb file in rails.

require 'resque/failure/redis_multi_queue'

Resque::Failure.backend = Resque::Failure::RedisMultiQueue

Defining custom failure backends

Using multiple failure backends at once

Using multiple failure backends is also useful. For example, you may want to get an Airbrake notification and be able to view the same exception under the 'Failed' tab in ResqueWeb. To use multiple failure backends, add something like the following to an initializer, rake task, or whatever:

require 'resque/failure/multiple'
require 'resque/failure/airbrake'
require 'resque/failure/redis'
Resque::Failure::Airbrake.configure do |config|
  config.api_key = 'fc49503482dec7bf13eda286c99ab2bf'
  config.secure = true # only set this to true if you are on a paid Airbrake plan
end
Resque::Failure::Multiple.classes = [Resque::Failure::Redis, Resque::Failure::Airbrake]
Resque::Failure.backend = Resque::Failure::Multiple