示例#1
0
            public void Accept(PeerCollector peerCollector, BindingKey routingKey)
            {
                if (IsLeaf(routingKey) || _matchesAll)
                {
                    peerCollector.Offer(_peers);
                    return;
                }

                _sharpNode?.Accept(peerCollector, routingKey);
                _starNode?.Accept(peerCollector, routingKey);

                var nextPart = routingKey.GetPart(_nextPartIndex);

                if (nextPart == null)
                {
                    return;
                }

                if (_childrenNodes == null)
                {
                    return;
                }

                SubscriptionNode childNode;

                if (_childrenNodes.TryGetValue(nextPart, out childNode))
                {
                    childNode.Accept(peerCollector, routingKey);
                }
            }
示例#2
0
        public IList <Peer> GetPeers(BindingKey routingKey)
        {
            var peerCollector = new PeerCollector(_peersMatchingAllMessages);

            _rootNode.Accept(peerCollector, routingKey);

            return(peerCollector.GetPeers());
        }
示例#3
0
        public IList<Peer> GetPeers(BindingKey routingKey)
        {
            var peerCollector = new PeerCollector(_peersMatchingAllMessages);

            _rootNode.Accept(peerCollector, routingKey);

            return peerCollector.GetPeers();
        }
示例#4
0
            public void AddAllPeers(PeerCollector peerCollector)
            {
                peerCollector.Offer(_peers);

                _sharpNode?.AddAllPeers(peerCollector);
                _starNode?.AddAllPeers(peerCollector);

                if (_childNodes == null)
                {
                    return;
                }

                foreach (var(_, childNode) in _childNodes)
                {
                    childNode.AddAllPeers(peerCollector);
                }
            }
示例#5
0
        public IList <Peer> GetPeers(BindingKey routingKey)
        {
            var peerCollector = new PeerCollector(_peersMatchingAllMessages);

            if (routingKey.IsEmpty)
            {
                // The message is not routable or has no routing member.

                // If the tree contains any subscription with a binding key, it indicates a message definition
                // mismatch between the publisher and the subscriber. In this situation, it is safer to send
                // the message to the subscriber anyway.

                // => Always forward the message to all peers.

                _rootNode.AddAllPeers(peerCollector);
            }
            else
            {
                _rootNode.Accept(peerCollector, routingKey);
            }

            return(peerCollector.GetPeers());
        }
示例#6
0
            public void Accept(PeerCollector peerCollector, BindingKey routingKey)
            {
                if (IsLeaf(routingKey))
                {
                    peerCollector.Offer(_peers);
                    return;
                }

                _sharpNode?.AddAllPeers(peerCollector);
                _starNode?.Accept(peerCollector, routingKey);

                var nextPart = routingKey.GetPart(_nextPartIndex);

                if (nextPart == null || _childNodes == null)
                {
                    return;
                }

                if (_childNodes.TryGetValue(nextPart, out var childNode))
                {
                    childNode.Accept(peerCollector, routingKey);
                }
            }
示例#7
0
            public void Accept(PeerCollector peerCollector, BindingKey routingKey)
            {
                if (IsLeaf(routingKey) || _matchesAll)
                {
                    peerCollector.Offer(_peers);
                    return;
                }

                if (_sharpNode != null)
                    _sharpNode.Accept(peerCollector, routingKey);

                if (_starNode != null)
                    _starNode.Accept(peerCollector, routingKey);

                var nextPart = routingKey.GetPart(_nextPartIndex);
                if (nextPart == null)
                    return;

                if (_childrenNodes == null)
                    return;

                SubscriptionNode childNode;
                if (_childrenNodes.TryGetValue(nextPart, out childNode))
                    childNode.Accept(peerCollector, routingKey);
            }