Skip to content

Instantly share code, notes, and snippets.

@adamwiggins
Created January 28, 2010 21:27
Show Gist options
  • Save adamwiggins/289159 to your computer and use it in GitHub Desktop.
Save adamwiggins/289159 to your computer and use it in GitHub Desktop.
#!/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