/// <summary> /// Close all channels and connections. /// </summary> public void CloseAll() { foreach (var channel in this.channels) { try { if (channel != ConnectionFactoryUtils.GetConsumerChannel()) { channel.Close(); } else { Logger.Debug(m => m("Skipping close of consumer channel: {0}", channel.ToString())); } } catch (Exception ex) { Logger.Debug("Could not close synchronized Rabbit Channel after transaction", ex); } } foreach (var connection in this.connections) { RabbitUtils.CloseConnection(connection); } this.connections.Clear(); this.channels.Clear(); this.channelsPerConnection.Clear(); }
/// <summary>Release the resource.</summary> /// <param name="resourceHolder">The resource holder.</param> /// <param name="resourceKey">The resource key.</param> protected override void ReleaseResource(RabbitResourceHolder resourceHolder, object resourceKey) { ConnectionFactoryUtils.ReleaseResources(resourceHolder); }