rabbitmq-tutorials/ruby/receive.rb
Michael Klishin 2316088e96 Disable automatic connection recovery for Bunny tutorials
It's not needed and will help investigate obscure exceptions
in CI environment.
2013-07-25 09:57:39 +04:00

22 lines
390 B
Ruby

#!/usr/bin/env ruby
# encoding: utf-8
require "bunny"
conn = Bunny.new(:automatically_recover => false)
conn.start
ch = conn.create_channel
q = ch.queue("hello")
begin
puts " [*] Waiting for messages. To exit press CTRL+C"
q.subscribe(:block => true) do |delivery_info, properties, body|
puts " [x] Received #{body}"
end
rescue Interrupt => _
conn.close
exit(0)
end