Created
January 28, 2010 21:27
-
-
Save adamwiggins/289159 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
require 'bunny' | |
require 'uri' | |
queue_name = ARGV.shift or abort "usage: bleed_queue <queue>" | |
def options | |
uri = URI.parse(ENV["AMQP_URL"]) | |
{ | |
:vhost => uri.path, | |
:host => uri.host, | |
:user => uri.user, | |
:port => uri.port, | |
:pass => uri.password | |
} | |
end | |
b = Bunny.new(options) | |
b.start | |
q = b.queue(queue_name) | |
puts "Bleeding queue #{queue_name}" | |
while ((msg = q.pop)[:payload] != :queue_empty) do | |
puts msg.inspect | |
end | |
puts "done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment