Blog

Search This Blog

Loading...

Tuesday, August 14, 2012

Elastic, Highly Available Backend for Delayed Job: IronMQ

Want an easy, scalable, highly available, zero maintenance Delayed Job backend?  Look no further. Here's a Delayed Job (DJ) backend gem that uses IronMQ. You can set it up in minutes and never have to worry about it again:

Delayed::Job IronMQ

Getting Started

Get Your Iron.io Credentials

Sign up for an Iron.io account if you don't already have one and add your credentials to an iron.json file or environment variables. You can read more about that here.

Add gem to Gemfile:


    gem 'delayed_job_ironmq'

That's It, Now Use It as Your Normally Would

I did say it was easy right?  Here's a simple example of how to use it:

Start worker process:
rake jobs:work

In your model:
class User
  def background_stuff
    puts "I run in the background"
  end
end

Now to run the background_stuff method in the background:
user = User.new
user.delay.background_stuff


More Information

For more details and configuration options, check out the gem README. And here's a demo Rails application that uses it so you can clone it and try it out.