I recently started seeing this error message in some of my logs:
NoMethodError: undefined method `add_shutdown_listener' for nil:NilClass
on_shutdown at /srv/bunyan/shared/bundle/jruby/2.3.0/gems/march_hare-2.18.0-java/lib/march_hare/channel.rb:183
initialize at /srv/bunyan/shared/bundle/jruby/2.3.0/gems/march_hare-2.18.0-java/lib/march_hare/channel.rb:135
create_channel at /srv/bunyan/shared/bundle/jruby/2.3.0/gems/march_hare-2.18.0-java/lib/march_hare/session.rb:169
block in setup_queue at /srv/bunyan/shared/bundle/jruby/2.3.0/gems/action_subscriber-3.0.0.pre2-java/lib/action_subscriber/route_set.rb:34
block in with_connection at /srv/bunyan/shared/bundle/jruby/2.3.0/gems/action_subscriber-3.0.0.pre2-java/lib/action_subscriber/rabbit_connection.rb:32
I spelunked through the code a bit and it looks like this a case where calling create_channel on the java connection returns nil, and then we pass that nil value into the constructor for the ruby Channel object.
Can we detect why the channel create failed in these cases? Can we raise an error about that failure rather than failing with an undefined method error?
I traced down the actual cause of my create_channel failing and it turned out that I had setup my broker to limit to the total number of channels for a given connection and one of my subscribers was trying to open more channels than the max.
Not sure if this information is available in the java driver or not.
The best we can do is to throw an exception if Java client's createChannel returns null.