Example #1
0
        public void Handle(PeerSubscriptionsForTypesUpdated message)
        {
            if (EnqueueIfRegistering(message))
            {
                return;
            }

            var peer = GetPeerCheckTimestamp(message.PeerId, message.TimestampUtc);

            if (peer.Value == null)
            {
                WarnWhenPeerDoesNotExist(peer, message.PeerId);
                return;
            }

            var subscriptionsForTypes = message.SubscriptionsForType ?? Array.Empty <SubscriptionsForType>();

            peer.Value.SetSubscriptionsForType(subscriptionsForTypes, message.TimestampUtc);

            PeerUpdated?.Invoke(message.PeerId, PeerUpdateAction.Updated);

            var observedSubscriptions = GetObservedSubscriptions(subscriptionsForTypes);

            if (observedSubscriptions.Count > 0)
            {
                PeerSubscriptionsUpdated?.Invoke(message.PeerId, observedSubscriptions);
            }
        }
Example #2
0
        public void Handle(PeerSubscriptionsForTypesUpdated message)
        {
            if (EnqueueIfRegistering(message))
            {
                return;
            }

            var peer = _peers.GetValueOrDefault(message.PeerId);

            if (peer == null)
            {
                return;
            }

            peer.SetSubscriptionsForType(message.SubscriptionsForType ?? Enumerable.Empty <SubscriptionsForType>(), message.TimestampUtc);

            PeerUpdated(message.PeerId, PeerUpdateAction.Updated);
        }
Example #3
0
        public void Handle(PeerSubscriptionsForTypesUpdated message)
        {
            if (EnqueueIfRegistering(message))
            {
                return;
            }

            var peer = GetPeerCheckTimestamp(message.PeerId, message.TimestampUtc);

            if (peer.Value == null)
            {
                WarnWhenPeerDoesNotExist(peer, message.PeerId);
                return;
            }

            peer.Value.SetSubscriptionsForType(message.SubscriptionsForType ?? Enumerable.Empty <SubscriptionsForType>(), message.TimestampUtc);

            PeerUpdated(message.PeerId, PeerUpdateAction.Updated);
        }