private void RemoveListener <TRequest, TResponse>(string topic, Guid id) { var root1 = typeof(TRequest).FullName; var root2 = typeof(TResponse).FullName; var path = topic.Split('.'); var listenerObj = _listeners.Get(root1, root2, path).FirstOrDefault(); if (!(listenerObj is IListener <TRequest, TResponse> listener) || listener.Id != id) { return; } _listeners.RemoveValue(root1, root2, path, ObjectManagement.TryDispose); }
private void Remove <TRequest, TResponse>(string topic, Guid id) { var root1 = typeof(TRequest).FullName; var root2 = typeof(TResponse).FullName; var path = topic.Split('.'); var channelObj = _channels.Get(root1, root2, path).FirstOrDefault(); if (!(channelObj is Channel <TRequest, TResponse> channel)) { return; } channel.Remove(id); if (channel.IsEmpty) { _channels.RemoveValue(root1, root2, path, ObjectManagement.TryDispose); } }