Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mitio/059f9938eee06f820d57c6b7f59fcc9a to your computer and use it in GitHub Desktop.
Save mitio/059f9938eee06f820d57c6b7f59fcc9a to your computer and use it in GitHub Desktop.
Demonstrate an edge case where RabbitMQ's Bunny Channel#wait_for_confirms may hand until it timeouts
require 'thread'
require 'bunny'
c = Bunny::Session.new(continuation_timeout: 1_000)
c.start
ch = c.create_channel
ch.confirm_select
x = ch.direct('test-exchange', durable: true)
q = ch.queue('', exclusive: true)
q.bind(x, routing_key: q.name)
# Delete the test exchange to cause a channel-level error
second_channel = c.create_channel
second_channel.exchange_delete(x.name)
puts 'Publishing (to a deleted channel)...'
x.publish('foobar', routing_key: q.name)
puts 'Waiting for confirms - it will timeout...'
x.wait_for_confirms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment