/// <summary> /// 关闭消息订阅连接 /// </summary> public void CloseReceiveMessage() { //注册消费者消息,消费者务必要在程序关闭后关掉(dispose)。否则导致异常终止,要人工等待连接超时后,方可重新注册。 if (Consumer != null) { Consumer.Dispose(); Consumer = null; } }
/// <summary> /// 关闭消息队列 /// </summary> public void CloseReceiveMessage() { try { if (Consumer != null) { Consumer.Dispose(); Consumer = null; } base.Dispose(); } catch (Exception e) { string str = e.Message; Consumer = null; } }