puts "hello1"
require 'bunny'
puts "hello2"
connection = Bunny.new(host: 0.0.0.0, user: 'myuser', pass: 'mypassword')
puts "hello3"
channel = connection.create_channel
queue = channel.queue('hello')
puts "hello4"
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: queue.name, mandatory: true)
puts " [x] Sent 'Hello World!'"
connection.close
hello1
hello2
hello3
hello4
[x] Sent 'Hello World!'
Thank you for your answer, indeed it is working when the message is not routed!I would like to have a return also when the message is routed correctly, it is possible ? According to my tests, turning mandatory to false is not a solution...
--
Bunny: http://rubybunny.info
March Hare: http://rubymarchhare.info
IRC: #rabbitmq on irc.freenode.net
Post to the group: ruby...@googlegroups.com | unsubscribe: ruby-amqp+...@googlegroups.com
---
You received this message because you are subscribed to the Google Groups "Ruby RabbitMQ libraries" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-amqp+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.