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 OnSubscribeTo(SubscribeTo message)
        {
            var key = new SubscriptionKey(message.MessageName, message.CorrelationId);

            BusSubscription subscription = _subscriptions.Get(key);

            if (_log.IsDebugEnabled)
                _log.DebugFormat("SubscribeTo: {0}, {1}", message.MessageName, message.SubscriptionId);

            subscription.OnSubscribeTo(message);
        }
        public void Send(AddPeerSubscription message)
        {
            var key = new SubscriptionKey(message.MessageName, message.CorrelationId);

            if (_log.IsDebugEnabled)
                _log.DebugFormat("AddPeerSubscription: {0}, {1}", message.MessageName, message.SubscriptionId);

            EndpointSubscription subscription = _messageSubscriptions[key];

            subscription.Send(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 void Send(RemovePeerSubscription message)
        {
            var key = new SubscriptionKey(message.MessageName, message.CorrelationId);

            _messageSubscriptions.WithValue(key, subscription =>
                {
                    if (_log.IsDebugEnabled)
                        _log.DebugFormat("RemovePeerSubscription: {0}, {1}", message.MessageName, message.SubscriptionId);

                    subscription.Send(message);
                });
        }
        public void Send(AddPeerSubscription message)
        {
            var key = new SubscriptionKey(message.MessageName, message.CorrelationId);

            if (_log.IsDebugEnabled)
            {
                _log.DebugFormat("AddPeerSubscription: {0}, {1}", message.MessageName, message.SubscriptionId);
            }

            EndpointSubscription subscription = _messageSubscriptions[key];

            subscription.Send(message);
        }
Exemple #7
0
        public void OnSubscribeTo(SubscribeTo message)
        {
            var key = new SubscriptionKey(message.MessageName, message.CorrelationId);

            BusSubscription subscription = _subscriptions.Get(key);

            if (_log.IsDebugEnabled)
            {
                _log.DebugFormat("SubscribeTo: {0}, {1}", message.MessageName, message.SubscriptionId);
            }

            subscription.OnSubscribeTo(message);
        }
        public void Send(RemovePeerSubscription message)
        {
            var key = new SubscriptionKey(message.MessageName, message.CorrelationId);

            _messageSubscriptions.WithValue(key, subscription =>
            {
                if (_log.IsDebugEnabled)
                {
                    _log.DebugFormat("RemovePeerSubscription: {0}, {1}", message.MessageName, message.SubscriptionId);
                }

                subscription.Send(message);
            });
        }
Exemple #9
0
        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 OnSubscribeTo(SubscribeTo message)
        {
            var key = new SubscriptionKey
                {
                    MessageName = message.MessageName,
                    CorrelationId = message.CorrelationId,
                };

            BusSubscription subscription;
            lock (_lock)
            {
                subscription = _subscriptions.Retrieve(key,
                    () => new BusSubscription(message.MessageName, message.CorrelationId, _observer));
            }

            if (_log.IsDebugEnabled)
                _log.DebugFormat("SubscribeTo: {0}, {1}", message.MessageName, message.SubscriptionId);

            subscription.OnSubscribeTo(message);
        }
		public void Send(AddPeerSubscription message)
		{
            var key = new SubscriptionKey
            {
                MessageName = message.MessageName,
                CorrelationId = message.CorrelationId,
            };

            EndpointSubscription subscription;
			if (!_messageSubscriptions.TryGetValue(key, out subscription))
			{
				subscription = new EndpointSubscription(_fiber, _scheduler, message.MessageName, message.CorrelationId, _observer);
				_messageSubscriptions.Add(key, subscription);
			}

			if (_log.IsDebugEnabled)
				_log.DebugFormat("AddPeerSubscription: {0}, {1}", message.MessageName, message.SubscriptionId);

			subscription.Send(message);
		}
		public void Send(RemovePeerSubscription message)
		{
            var key = new SubscriptionKey
            {
                MessageName = message.MessageName,
                CorrelationId = message.CorrelationId,
            };


			EndpointSubscription subscription;
			if (_messageSubscriptions.TryGetValue(key, out subscription))
			{
				if (_log.IsDebugEnabled)
					_log.DebugFormat("RemovePeerSubscription: {0}, {1}", message.MessageName, message.SubscriptionId);

				subscription.Send(message);
			}
			else
			{
				if (_log.IsDebugEnabled)
					_log.DebugFormat("RemovePeerSubscription(unknown): {0}, {1}", message.MessageName, message.SubscriptionId);
			}
		}