Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Simple formating of code block to appears correctly on Github

  • Loading branch information...
commit 82447de0f0059b373b82406eea077f40e8cf3dd8 1 parent 230467f
@JonathanTron JonathanTron authored
Showing with 22 additions and 24 deletions.
  1. +22 −24 README.rdoc
View
46 README.rdoc
@@ -1,4 +1,3 @@
-
= Minion: super simple job queue over amqp
Minion makes processing jobs over AMQP simple and easy.
@@ -7,7 +6,7 @@ Minion makes processing jobs over AMQP simple and easy.
Minion pulls the AMQP credentials out the environment via AMQP_URL.
- $ export AMQP_URL="amqp://johndoe:abc123@localhost/my_vhost"
+ $ export AMQP_URL="amqp://johndoe:abc123@localhost/my_vhost"
Alternativly you can explicitly set it programmatically like this:
@@ -36,36 +35,36 @@ in parallel, run two minions.
Its easy to push a job onto the queue.
- Minion.enqueue("make.sandwich", { "for" => "me", "with" => "bread" })
+ Minion.enqueue("make.sandwich", { "for" => "me", "with" => "bread" })
Minion expects a queue name (and will create it if needed). The second argument
needs to be a hash.
== Processing a job
- require 'minion'
+ require 'minion'
- include Minion
+ include Minion
- job "make.sandwich" do |args|
- Sandwich.make(args["for"],args["with"])
- end
+ job "make.sandwich" do |args|
+ Sandwich.make(args["for"],args["with"])
+ end
== Chaining multiple steps
If you have a task that requires more than one step just pass an array of
queues when you enqueue.
- Minion.enqueue([ "make.sandwich", "eat.sandwich" ], "for" => "me")
+ Minion.enqueue([ "make.sandwich", "eat.sandwich" ], "for" => "me")
- job "make.sandwich" do
- ## this return value is merged with for => me and sent to the next queue
- { "type" => "ham on rye" }
- end
+ job "make.sandwich" do
+ ## this return value is merged with for => me and sent to the next queue
+ { "type" => "ham on rye" }
+ end
- job "eat.sandwich" do |args|
- puts "I have #{args["type"]} sandwich for #{args["me"]}"
- end
+ job "eat.sandwich" do |args|
+ puts "I have #{args["type"]} sandwich for #{args["me"]}"
+ end
== Conditional Processing
@@ -84,17 +83,17 @@ When an error is thrown in a job handler, the job is requeued to be done later
and the minion process exits. If you define an error handler, however, the
error handler is run and the job is removed from the queue.
- error do |e|
- puts "got an error! #{e}"
- end
+ error do |e|
+ puts "got an error! #{e}"
+ end
== Logging
Minion logs to stdout via "puts". You can specify a custom logger like this:
- logger do |msg|
- puts msg
- end
+ logger do |msg|
+ puts msg
+ end
== Meta
@@ -102,5 +101,4 @@ Created by Orion Henry
Patches contributed by Adam Wiggins, Kyle Drake
-Released under the MIT License: www.opensource.org/licenses/mit-license.php
-
+Released under the MIT License: www.opensource.org/licenses/mit-license.php
Please sign in to comment.
Something went wrong with that request. Please try again.