Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 1.02 KB

README.md

File metadata and controls

48 lines (33 loc) · 1.02 KB

RCelery: celery for Ruby

RCelery is a Ruby port of [celery] (http://github/ask/celery), the distributed task queue for python. It does not support all of the features of celery, but does interoperate well with it, as long as both sides use the AMQP backend and json serializer.

Example

Note: To run the example as-is, rabbitmq must be running and accepting connections on localhost port 5672. Access must be allowed to the default vhost for the default username and password.

tasks.rb:

require 'rcelery'

module Tasks
  include RCelery::TaskSupport

  task(:ignore_result => false)
  def subtract(a,b)
    a-b
  end
end

client.rb:

require 'rubygems'
require 'rcelery'
require 'tasks'

RCelery.start

include Tasks

difference = subtract.delay(1,2)
puts "Subtract Result: #{difference.wait}"

Run the example:

$ ruby bin/rceleryd -t tasks.rb &
$ ruby client.rb

See the RCelery docmentation for more information.