Skip to content
Eric Draut edited this page Aug 6, 2016 · 9 revisions

An industrial-strength background worker system for Rails using RabbitMQ

Submit a Job

The submit method in it's basic form takes a Ruby class, a method name as a symbol, and an array of arguments to be passed to the method. You can run any method in the background, it doesn't need to be blessed as an asynchronous method.

ConeyIsland.submit(Account, :do_something_slow, args: [@stuff,@other_things])
#more options available, see docs

If you want to make *_async methods available and set class-level defaults, include the Performer module.

class Person < ActiveRecord::Base
  include ConeyIsland::Performer
  set_background_defaults(timeout: 60, work_queue: 'my_slow_queue')

  def self.refresh_all_social_profiles
    #iterate over people to be refreshed here
  end

  def refresh_social_profile(facebook_only: false, twitter_only: false)
    #go out to the network and get fresh social data
  end
end

person = Person.first
person.refresh_social_profile_async(facebook_only: true)

See more options for submitting jobs.

Install It

In your gemfile

gem 'coney_island'

All the Things

Clone this wiki locally