RabbitMQ IModel.Dispose挂起

时间:2015-03-19 23:41:55

标签: c# .net rabbitmq

出于某种原因,这种情况开始发生。昨天没事。我的客户在channel.BasicPublish返回channel.Dispose后挂起。我的连接不好,即它处于打开状态,应用程序未按https://groups.google.com/forum/?fromgroups=#!topic/rabbitmq-discuss/5nzeEqI5qxw中的建议关闭。两种方式都表现相同:

using (var channel = _connection.CreateModel()) {
  //use channel here
}

var channel = _connection.CreateModel()
//use channel here
channel.Dispose();

1 个答案:

答案 0 :(得分:0)

他们在此问题上遇到了错误25255 - link

现在尝试在此次通话时使用超时。

private void DisconnectWithTimeout(IConnection connection, int timeoutMillis)
{
    var task = Task.Run(() => connection.Dispose());

    if (!task.Wait(timeoutMillis))
    {
        //timeout
        throw new TimeoutException("Timeout on connection.Dispose()");
    }
}