Created
October 14, 2011 17:26
-
-
Save 198d/1287741 to your computer and use it in GitHub Desktop.
RCelery Getting Started
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task(:ignore_result => false) | |
def add(a,b) | |
a + b | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task(:routing_key => 'some.other.applcation') | |
def cross_application | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add().delay(1,2) # => #<RCelery::AsyncResult:0x10a406540 ... > | |
one().delay() # => nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Placeholder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include GettingStarted | |
add() # => #<RCelery::Task:0x1102f9390 ... > | |
add(1,2) # => 3 | |
one(nil) # => 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task(:name => 'tasks.number_one') | |
def one | |
1 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
development: | |
host: localhost | |
production: | |
host: prod.mq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'rcelery' | |
RCelery.start( | |
:host => 'localhost', | |
:port => '5672', | |
:vhost => '/', | |
:username => 'guest', | |
:password => 'guest', | |
:application => 'application' | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module GettingStarted | |
include RCelery::TaskSupport | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment