You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 11, 2022. It is now read-only.
I'm using amqp-1.5 on Linux and the auto-recovery feature works great with named queues. But I experience some issues with server-named queues.
Steps to reproduce:
Open a single server-named queue and subscribe to it
Restart RabbitMQ server
amqp reconnects the server-named queue which gets a new name. queue.on_recovery gets called twice for the same queue. One queue is visible on RabbitMQ Management UI
Restart RabbitMQ server
amqp reconnects two server queues with two new names. queue.on_recovery gets called 4 times with the same queue. Two queues are visible on RabbitMQ Management UI.
On every RabbitMQ restart I get more and more calls to the queue.on_recovery callback and the number of queues on the server increases.
Closing the client removes all the server-named queues on RabbitMQ.
I used this test script:
require 'rubygems'
require 'amqp'
config = { :host => 'localhost', :username => 'guest', :password => 'guest' }
EventMachine.run do
conn = AMQP.connect(@config) do |client|
puts "Initial connect."
conn.on_recovery do
puts "Connection restored"
end
conn.on_tcp_connection_loss do |conn, settings|
puts "[network failure] Trying to reconnect..."
conn.reconnect(false, 2)
end
# Connection up, connect channel, use auto_recovery
channel = AMQP::Channel.new(conn)
channel.auto_recovery = true
AMQP::Queue.new(channel, "", :auto_delete => true, :exclusive => true) do |queue, declare_ok|
puts "#{queue.name} is ready to go. AMQP method: #{declare_ok.inspect}"
queue.subscribe(:ack => false) do |header,data|
puts "queue.subscribe called with message #{data}"
end
queue.on_recovery do |recQueue|
puts "queue.on_recovery called for queue #{recQueue} named #{recQueue.name}"
end
end
end
end
Output while running:
$ ruby reconnect_test.rb
Initial connect.
amq.gen-dXrBy45YS1hZD8ffThK_RA is ready to go. AMQP method: #<AMQ::Protocol::Queue::DeclareOk:0x7f6a0b4aff98 @queue="amq.gen-dXrBy45YS1hZD8ffThK_RA", @consumer_count=0, @message_count=0>
// RabbitMQ restarted here...
[network failure] Trying to reconnect...
[network failure] Trying to reconnect...
[network failure] Trying to reconnect...
[network failure] Trying to reconnect...
[network failure] Trying to reconnect...
[network failure] Trying to reconnect...
Connection restored
queue.on_recovery called for queue #<AMQP::Queue:0x7f9cd2c97428> named amq.gen-D7mIbnnR2jmyvnhKRb6r0g
queue.on_recovery called for queue #<AMQP::Queue:0x7f9cd2c97428> named amq.gen-bylghjGFgEPcLkoj8fIE8A
// RabbitMQ restarted here...
[network failure] Trying to reconnect...
[network failure] Trying to reconnect...
[network failure] Trying to reconnect...
[network failure] Trying to reconnect...
[network failure] Trying to reconnect...
[network failure] Trying to reconnect...
Connection restored
queue.on_recovery called for queue #<AMQP::Queue:0x7f9cd2c97428> named amq.gen-bylghjGFgEPcLkoj8fIE8A
queue.on_recovery called for queue #<AMQP::Queue:0x7f9cd2c97428> named amq.gen-bylghjGFgEPcLkoj8fIE8A
queue.on_recovery called for queue #<AMQP::Queue:0x7f9cd2c97428> named amq.gen-K4pZgJCMOXxzgeTVcZfywg
queue.on_recovery called for queue #<AMQP::Queue:0x7f9cd2c97428> named amq.gen-K4pZgJCMOXxzgeTVcZfywg
// RabbitMQ restarted here...
[network failure] Trying to reconnect...
[network failure] Trying to reconnect...
[network failure] Trying to reconnect...
[network failure] Trying to reconnect...
[network failure] Trying to reconnect...
[network failure] Trying to reconnect...
Connection restored
queue.on_recovery called for queue #<AMQP::Queue:0x7f9cd2c97428> named amq.gen-K4pZgJCMOXxzgeTVcZfywg
queue.on_recovery called for queue #<AMQP::Queue:0x7f9cd2c97428> named amq.gen-K4pZgJCMOXxzgeTVcZfywg
queue.on_recovery called for queue #<AMQP::Queue:0x7f9cd2c97428> named amq.gen-K4pZgJCMOXxzgeTVcZfywg
queue.on_recovery called for queue #<AMQP::Queue:0x7f9cd2c97428> named amq.gen-w3zp3WJlDS8fGLGYry3UEw
queue.on_recovery called for queue #<AMQP::Queue:0x7f9cd2c97428> named amq.gen-w3zp3WJlDS8fGLGYry3UEw
queue.on_recovery called for queue #<AMQP::Queue:0x7f9cd2c97428> named amq.gen-w3zp3WJlDS8fGLGYry3UEw
For me it looks like queue.on_recovery get's called for the old (now invalid) queue name and once for the new one. Additionally there's one more queue after every RabbitMQ restart. Maybe two different issues or just me doing something wrong...
I'm using amqp-1.5 on Linux and the auto-recovery feature works great with named queues. But I experience some issues with server-named queues.
Steps to reproduce:
On every RabbitMQ restart I get more and more calls to the queue.on_recovery callback and the number of queues on the server increases.
Closing the client removes all the server-named queues on RabbitMQ.
I used this test script:
Output while running:
For me it looks like queue.on_recovery get's called for the old (now invalid) queue name and once for the new one. Additionally there's one more queue after every RabbitMQ restart. Maybe two different issues or just me doing something wrong...
Thanks,
Thomas