public void CloseSubscribeChannel(Uri networkAddress, string address) { if (!IsOpen) { throw new Exception("The Endpoint must be open before adding or removing channels."); } string key = networkAddress.ToString(); AmqpConnection channel = null; if (channels.ContainsKey(key)) { channel = channels[key]; channel.RemoveChannel(address); } else { throw new ArgumentException("The specified channel does not exist."); } }
/// <summary> /// Closes the specified publish channel (that was opened previously via a call to AddPublishChannel. /// </summary> /// <param name="networkAddress">The network address of the channel to be closed.</param> /// <param name="address">The AMQP target address of the channel to be closed.</param> public void ClosePublishChannel(Uri networkAddress, string address) { if (!IsOpen) { throw new Exception("The Endpoint must be open before adding or removing channels."); } string key = networkAddress.ToString(); AmqpConnection channel = null; if (channels.ContainsKey(key)) { while (!channels.TryRemove(key, out channel)) { Task.Yield(); } channel.RemoveChannel(address); } else { throw new ArgumentException("The specified channel does not exist."); } }