Skip to content

Instantly share code, notes, and snippets.

@michaelklishin
Created November 6, 2018 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelklishin/4820cfb81491bf980dd8ac404bc3369a to your computer and use it in GitHub Desktop.
Save michaelklishin/4820cfb81491bf980dd8ac404bc3369a to your computer and use it in GitHub Desktop.
require 'bunny'
connection = Bunny.new
connection.start
channel = connection.create_channel
queue = channel.queue('hello-ret')
exch = channel.default_exchange
exch.on_return do |return_info, properties, content|
puts "Got a returned message : #{content}"
puts return_info.inspect
puts properties.inspect
message = content
end
exch.publish('Hello World!', routing_key: rand.to_s, mandatory: true)
sleep 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment