RabbitMQ连接上了如果要退出需要关闭两个连接

IConnection _connection = null;
 IModel _channel = null;
 EventingBasicConsumer _consumer = null;

if (null != _consumer && _consumer.IsRunning)
{
                    if (null != _channel) _channel.Close();
                    if (null != _connection) _connection.Close();
                    //这样就可以安全退出了
}

猜你喜欢

转载自www.cnblogs.com/liaojianwang/p/9395444.html