[rabbitmq-discuss] Connection.createChannel() hangs using amqp-client 3.1.1

Jonathan Halterman jhalterman at gmail.com
Thu Jun 6 23:42:34 BST 2013


I hit on a scenario where connection.createChannel() may hang forever. The
scenario: obtain a channel and attempt to publish to a non-existent
exchange. The channel will be shutdown. Attempt to establish a new
(replacement) channel via Connection.createChannel(), which hangs forever.
A simple version of this scenario:

public Channel channelFor(final String tenantId) throws Exception {
  Channel channel = connection.createChannel();
  channel.addShutdownListener(new ShutdownListener() {
    public void shutdownCompleted(ShutdownSignalException e) {
      if (!e.isInitiatedByApplication())
        channelFor(tenantId);
    }
  });

  return channel;
}

Channel channel = channelFor("foo");
channel.basicPublish(someNonExistentExchange, …



More information about the rabbitmq-discuss mailing list