IronMQ backend for delayed_job
Switch branches/tags
Pull request Compare This branch is 30 commits ahead of treeder:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

This is IronMQ backend for delayed_job

Getting Started

Get credentials

Heroku users: Simply add the IronMQ add-on and you can skip the rest of this section. It will be setup automatically when you add the IronMQ add-on.

To start using delayed_job_ironmq, you need to sign up for and setup your credentials.

  1. Go to and sign up.
  2. Get an Oauth Token at
  3. Add an iron.json file or setup environment variables for authentication. See for details.


Add the gems to your Gemfile:

gem 'delayed_job'
gem 'delayed_job_ironmq'

Optionally: Add an initializer (config/initializers/delayed_job.rb):

Delayed::Worker.configure do |config|
  # optional params:
  config.available_priorities = [-1,0,1,2] # Default is [0]. Please note, adding new priorities will slow down picking the next job from queue.  Also note that these priorities must include all priorities of your Delayed Jobs.
  config.queue_name = 'default' # Specify an alternative queue name
  config.delay = 0  # Time to wait before message will be available on the queue
  config.timeout = 5.minutes # The time in seconds to wait after message is taken off the queue, before it is put back on. Delete before :timeout to ensure it does not go back on the queue.
  config.expires_in = 7.days # After this time, message will be automatically removed from the queue.


That's it. Use delayed_job as normal.


class User
  def background_stuff
    puts "I run in the background"

Then in one of your controllers:

user =

Start worker process

rake jobs:work

That will start pulling jobs off the queue and processing them.

Compatibility with delayed_job 4.0.4 and higher

If you are using the last versions of delayed_job gem you can see the following error while running the above example :

Error while reserving job: undefined class/module User

To fix it move the user.rb file to lib/tasks/user.rake (user.rb should be renamed to user.rake) or add the path to user.rb in Rakefile:

require File.expand_path('path_to_user.rb', __FILE__)

Demo Rails Application

Here's a demo rails app you can clone and try it out:

Using with Heroku

To use with Heroku, just add the IronMQ Add-on and you're good to go.


You can find more documentation here: