public void OnUnsubscribeFrom(UnsubscribeFrom removed) { lock (_ids) { if (!_ids.Contains(removed.SubscriptionId)) { return; } _ids.Clear(); } var remove = new SubscriptionRemovedMessage { SubscriptionId = _subscriptionId, EndpointUri = _endpointUri, MessageName = _messageName, CorrelationId = _correlationId, }; _log.DebugFormat("UnsubscribeFrom: {0}, {1}", _messageName, _subscriptionId); _observer.OnSubscriptionRemoved(remove); _subscriptionId = Guid.Empty; }
public void OnUnsubscribeFrom(UnsubscribeFrom message) { var key = new SubscriptionKey { MessageName = message.MessageName, CorrelationId = message.CorrelationId, }; BusSubscription subscription; bool result; lock (_lock) result = _subscriptions.TryGetValue(key, out subscription); if (result) { if (_log.IsDebugEnabled) _log.DebugFormat("UnsubscribeFrom: {0}, {1}", message.MessageName, message.SubscriptionId); subscription.OnUnsubscribeFrom(message); } else { if (_log.IsDebugEnabled) _log.DebugFormat("UnsubscribeFrom(unknown): {0}, {1}", message.MessageName, message.SubscriptionId); } }
public void OnUnsubscribeFrom(UnsubscribeFrom message) { var key = new SubscriptionKey(message.MessageName, message.CorrelationId); _subscriptions.WithValue(key, subscription => { if (_log.IsDebugEnabled) _log.DebugFormat("UnsubscribeFrom: {0}, {1}", message.MessageName, message.SubscriptionId); subscription.OnUnsubscribeFrom(message); }); }
public void OnUnsubscribeFrom(UnsubscribeFrom message) { var key = new SubscriptionKey(message.MessageName, message.CorrelationId); _subscriptions.WithValue(key, subscription => { if (_log.IsDebugEnabled) { _log.DebugFormat("UnsubscribeFrom: {0}, {1}", message.MessageName, message.SubscriptionId); } subscription.OnUnsubscribeFrom(message); }); }
public Task Handle(UnsubscribeFrom msg) { List <IHandlerWrapper> handlerList; if (_handlers.TryGetValue(msg.Type, out handlerList)) { handlerList = new List <IHandlerWrapper>(); handlerList.RemoveAll(x => x.IsSame(msg.Handler)); if (handlerList.Count == 0) { _handlers.Remove(msg.Type); } } return(Task.CompletedTask); }
public void OnUnsubscribeFrom(UnsubscribeFrom message) { BusSubscription actor; if (_subscriptions.TryGetValue(message.MessageName, out actor)) { if (_log.IsDebugEnabled) _log.DebugFormat("UnsubscribeFrom: {0}, {1}", message.MessageName, message.SubscriptionId); actor.OnUnsubscribeFrom(message); } else { if (_log.IsDebugEnabled) _log.DebugFormat("UnsubscribeFrom(unknown): {0}, {1}", message.MessageName, message.SubscriptionId); } }
public void OnUnsubscribeFrom(UnsubscribeFrom removed) { if (!_ids.Contains(removed.SubscriptionId)) return; _ids.Clear(); var remove = new SubscriptionRemovedMessage { SubscriptionId = _subscriptionId, EndpointUri = _endpointUri, MessageName = _messageName }; _log.DebugFormat("UnsubscribeFrom: {0}, {1}", _messageName, _subscriptionId); _observer.OnSubscriptionRemoved(remove); _subscriptionId = Guid.Empty; }