publisher: fixed channel_max negotiation for servers which set channel_max
MODIFY
Rakefile
Rakefile
@@ -42,6 +42,7 @@ namespace :rabbit do
def create_config_file(config_file, web_port)
File.open("#{config_file}.config",'w') do |f|
f.puts "["
+ f.puts " {rabbit, [{channel_max, 1000}]},"
f.puts " {rabbitmq_management, [{listener, [{port, #{web_port}}]}]}"
f.puts "]."
end

MODIFY
lib/beetle/configuration.rb
lib/beetle/configuration.rb
@@ -55,8 +55,12 @@ module Beetle
attr_accessor :user
# the password to use when connectiong to the AMQP servers (defaults to <tt>"guest"</tt>)
attr_accessor :password
- # the maximum permissible size of a frame (in bytes). Defaults to 128 KB
+ # the maximum permissible size of a frame (in bytes). defaults to 128 KB
attr_accessor :frame_max
+ # the max number of channels the publisher tries to negotiate with the server. Defaults
+ # to 2047, which is the RabbitMQ default in 3.7. We can't set this to 0 because of a bug
+ # in bunny.
+ attr_accessor :channel_max
# In contrast to RabbitMQ 2.x, RabbitMQ 3.x preserves message order when requeing a message. This can lead to
# throughput degradation (when rejected messages block the processing of other messages
@@ -127,6 +131,7 @@ module Beetle
self.password = "guest"
self.api_port = 15672
self.frame_max = 131072
+ self.channel_max = 2047
self.prefetch_count = 1
self.dead_lettering_enabled = false

MODIFY
lib/beetle/publisher.rb
lib/beetle/publisher.rb
@@ -166,6 +166,7 @@ module Beetle
:pass => @client.config.password,
:vhost => @client.config.vhost,
:frame_max => @client.config.frame_max,
+ :channel_max => @client.config.channel_max,
:socket_timeout => @client.config.publishing_timeout,
:spec => '09')
b.start

MODIFY
test/beetle/publisher_test.rb
test/beetle/publisher_test.rb
@@ -25,6 +25,7 @@ module Beetle
:vhost => "/",
:socket_timeout => 0,
:frame_max => 131072,
+ :channel_max => 2047,
:spec => '09'
}
Bunny.expects(:new).with(expected_bunny_options).returns(m)

publisher: fixed channel_max negotiation for servers which set channel_max