Created
July 18, 2016 16:41
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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