Exemple #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);
                }
            }
Exemple #2
0
        public IList <Peer> GetPeers(BindingKey routingKey)
        {
            var peerCollector = new PeerCollector(_peersMatchingAllMessages);

            _rootNode.Accept(peerCollector, routingKey);

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

            _rootNode.Accept(peerCollector, routingKey);

            return peerCollector.GetPeers();
        }
Exemple #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);
                }
            }
Exemple #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());
        }
Exemple #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);
                }
            }
            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);
            }