Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Really simple Rails task queuing / delayed message passing

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 app
Octocat-spinner-32 config
Octocat-spinner-32 generators
Octocat-spinner-32 lib
Octocat-spinner-32 script
Octocat-spinner-32 spec
Octocat-spinner-32 README
Octocat-spinner-32 Rakefile
Octocat-spinner-32 install.rb
Octocat-spinner-32 uninstall.rb

TaskQueue makes it simple to schedule (probably non-urgent) method calls by storing 

  * a reference to your target object, 
  * the method to call on it,
  * any arguments to pass to that method,
  * when you want it to happen

At the moment, it's just another copy of your Rails app server running as a daemon service. It'd be nice to move this to a lighter server or a DRb instance or something.

Example usage:

  u = User.find :first
  TaskQueue.schedule(u, :send_password_reset_mail)
  TaskQueue.schedule(u, :send_witty_but_sincere_letter, 2.days.from_now)
  TaskQueue.schedule(u, :set_status, "awesome")
  TaskQueue.schedule(u, :set_status, "ambivalent",

== Possible bugs

  * running multiple TaskQueue daemons is a bad idea due to the possibility of race conditions (i.e. there's no locking happening to prevent tasks from being executed more than once).

== Todo
  * Add logging
  * Add a flag not to fork/daemonize
  * Write a TaskQueue.schedule_code to allow delayed/asynchronous evaluation of code

== Installation

  ruby script/plugin install git://

=== Prepare database

Generate and apply the migration:

  ruby script/generate task_queue_migration
  rake db:migrate
Fire this puppy up:

  ruby script/task_queue_daemon start

Shut 'er down:

  ruby script/task_queue_daemon stop

Restart the task queue daemon:

  ruby script/task_queue_daemon restart

== Usage

  c = Customer.find :first
  TaskQueue.schedule c, :to_salesforce,

Copyright (c) 2007 Edward Ocampo-Gooding, Patrick Ritchie, released under the MIT license
Something went wrong with that request. Please try again.