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();
                    //这样就可以安全退出了
}

posted @ 2018-07-31 13:49  健忘就忘吧  阅读(2276)  评论(0编辑  收藏  举报