public RemoveActivation Create <TMessage>(Consumer <TMessage> consumer, RoutingEngineConfigurator configurator)
        {
            var requestConsumer = consumer as Consumer <Response <T> >;
            var consumerNode    = new ConsumerNode <Response <T> >(configurator.Engine, requestConsumer);

            return(AddActivation(configurator, consumerNode));
        }
Пример #2
0
        protected override bool Visit <T>(ConsumerNode <T> node)
        {
            _current = GetVertex(node.GetHashCode(), () => "P", typeof(ConsumerNode <>), typeof(T));

            LinkFromParent();

            return(WithVertex(() => base.Visit(node)));
        }
Пример #3
0
        public void can_add_consumer()
        {
            testConsumer = TestConsumer.ForDeposit(Keccak.Zero)
                           .WithNode(1).AddSession().WithUnpaidUnits(10)
                           .And.Build();

            ConsumerNode     consumerNode = testConsumer.Node(1).Node;
            INdmProviderPeer consumerPeer = consumerNode.Peer;

            ConsumerNode[] pre = sessionManager.GetConsumerNodes().ToArray();
            bool           consumerAlreadyAdded = pre.Contains(consumerNode);

            Assert.IsTrue(!consumerAlreadyAdded);

            providerService.AddConsumerPeer(consumerPeer);
            var addedConsumer = sessionManager.GetConsumerNodes().Where(node => node.Peer.Equals(consumerPeer));

            Assert.IsTrue(addedConsumer != null);
        }
Пример #4
0
        private void TryRemovePeer(ConsumerNode consumerNode, INdmProviderPeer peer)
        {
            if (consumerNode.HasSessions)
            {
                if (_logger.IsInfo)
                {
                    _logger.Info($"Connected node: '{peer.NodeId}' has active sessions and will not be removed.");
                }

                return;
            }

            if (Nodes.TryRemove(peer.NodeId, out _))
            {
                return;
            }

            if (_logger.IsError)
            {
                _logger.Error($"Node: '{peer.NodeId}' for address: '{peer.ProviderAddress}' couldn't be removed.");
            }
        }
 protected virtual bool Visit <T>(ConsumerNode <T> node)
 {
     return(true);
 }
Пример #6
0
 public TestConsumerNode(int id, ConsumerNode node)
 {
     Id   = id;
     Node = node;
 }
Пример #7
0
        protected override bool Visit <T>(ConsumerNode <T> node)
        {
            AppendLine(node.GetType().ToShortTypeName());

            return(base.Visit(node));
        }