Skip to content

Process background tasks for Rails applications using IronWorker.

License

Notifications You must be signed in to change notification settings

hjblok/rails_iron

Repository files navigation

RailsIron

Gem Version Build Status Code Climate Coverage Status Dependency Status

Process background tasks for Rails applications using IronWorker. The aim is to provide a Sidekiq compatible interface.

Installation

$ gem install rails_iron

Usage

Add a worker into your app/workers folder:

# app/workers/my_hard_worker.rb
require "rails_iron"

class MyHardWorker
  include RailsIron::Worker

  def perform
    10.times { "hard work" }
  end
end

The require "rails_iron" is necessary to boot your Iron.io worker.

Now go ahead and create a background task from within your application:

MyHardWorker.perform_async

You may also supply arguments to the worker:

# app/workers/my_hard_worker.rb
require "rails_iron"

class MyHardWorker
  include RailsIron::Worker

  def perform(work)
    puts "hard #{work}"
  end
end

MyHardWorker.perform_async("rock")

Todo

This library isn't finished yet, the following is still missing:

  • a Rake task for building and uploading the worker
  • documentation on how to supply ENV variables
  • a mechanism to catch Rails database timeouts during boot time

Testing

To run the tests:

$ rspec

Contributing

  1. Fork it.
  2. Create a branch (git checkout -b my_feature)
  3. Commit your changes (git commit -am "Added Feature")
  4. Push to the branch (git push origin my_feature)
  5. Open a Pull Request
  6. Enjoy a refreshing Diet Coke and wait

License

Please see LICENSE for licensing details.

Author

Harm-Jan Blok, http://sudoit.nl

About

Process background tasks for Rails applications using IronWorker.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages