public void Unsubscribe(IIntegrationEventHandler handler) { var eventType = handler.GetType().BaseType.GetGenericArguments().First(); if (_handlers.ContainsKey(eventType)) { _handlers.Remove(eventType); if (!_persistentConnection.IsConnected) { _policy.Execute((context) => _persistentConnection.TryConnect(), new Dictionary <string, object>() { { "logmessage", "RabbitMQ Client could not connect " } }); } _persistentConnection.CreateChannel(); _persistentConnection.RemoveRoutingKey(eventType.Name); } }