Ejemplo n.º 1
0
        public RabbitMqListenerService(IRabbitMqConfig config, int retryCount, IMessageCoordinator messageCoordinator)
        {
            this.config             = config;
            this.messageCoordinator = messageCoordinator;

            ConnectAndListen(retryCount);
        }
Ejemplo n.º 2
0
 public NodeLauncherFactory(IRpcNodeFactory rpcNodeFactory, IBlockChainStore blockChainStore, IMessageCoordinator messageCoordinator, ISmartContractStore smartContractStore)
 {
     _rpcNodeFactory     = rpcNodeFactory;
     _blockChainStore    = blockChainStore;
     _messageCoordinator = messageCoordinator;
     _smartContractStore = smartContractStore;
 }
Ejemplo n.º 3
0
 public P2PNode(Networks network, ServiceFlags serviceFlag, P2PNetworkConnector p2pNetworkConnector, IMessageCoordinator messageCoordinator)
 {
     _network             = network;
     _serviceFlag         = serviceFlag;
     _p2pNetworkConnector = p2pNetworkConnector;
     _messageParser       = new MessageParser();
     _messageCoordinator  = messageCoordinator;
     _ipAdrHelper         = new IpAdrHelper();
 }
Ejemplo n.º 4
0
 public PeerConnector(Networks network, P2PNetworkConnector p2pNetworkConnector, IMessageCoordinator messageCoordinator)
 {
     _autoEvent     = new AutoResetEvent(false);
     _client        = null;
     _network       = network;
     _messageParser = new MessageParser();
     _cheeckPeerAvailabilityWorker         = new BackgroundWorker();
     _cheeckPeerAvailabilityWorker.DoWork += CheckPeerAvailability;
     _messageCoordinator = messageCoordinator;
 }
        public P2PNetworkConnector(IMessageCoordinator messageCoordinator)
        {
            _peers              = new ConcurrentBag <PeerConnector>();
            _messageParser      = new MessageParser();
            _peersRepository    = new PeersRepository();
            _messageCoordinator = messageCoordinator;
            var instance = PeerEventStore.Instance();

            instance.NewPeerEvt += ListenPeer;
            P2PConnectorEventStore.Instance().NewBlockEvt       += BroadcastNewBlock;
            P2PConnectorEventStore.Instance().NewTransactionEvt += BroadcastNewTransaction;
        }
        public static HttpPresenterBinder Create(
            IEnumerable <object> hosts,
            HttpContext context,
            IPlatformServices platformServices,
            IMessageCoordinator messageCoordinator)
        {
            Require.NotNull(platformServices, nameof(platformServices));

            return(new HttpPresenterBinder(
                       hosts,
                       context,
                       platformServices.PresenterDiscoveryStrategy,
                       platformServices.PresenterFactory,
                       platformServices.CompositeViewFactory,
                       messageCoordinator));
        }
Ejemplo n.º 7
0
        public HttpPresenterBinder(
            IEnumerable <object> hosts,
            HttpContext context,
            IPresenterDiscoveryStrategy presenterDiscoveryStrategy,
            IPresenterFactory presenterFactory,
            ICompositeViewFactory compositeViewFactory,
            IMessageCoordinator messageCoordinator)
            : base(
                hosts,
                presenterDiscoveryStrategy,
                presenterFactory,
                compositeViewFactory,
                messageCoordinator)
        {
            Require.NotNull(context, nameof(context));

            _context = context;
        }
Ejemplo n.º 8
0
        public AwsSqsMessageQueueClient(ISqsClient sqsClient, IMessageCoordinator messageCoordinator, IDictionary <string, string> queueNames, Action onPublishedCallback)
            : base(onPublishedCallback)
        {
            if (sqsClient == null)
            {
                throw new ArgumentNullException("sqsClient");
            }

            if (messageCoordinator == null)
            {
                throw new ArgumentNullException("messageCoordinator");
            }

            if (queueNames == null)
            {
                throw new ArgumentNullException("queueNames");
            }

            this.SqsClient          = sqsClient;
            this.MessageCoordinator = messageCoordinator;
            this.QueueNames         = queueNames;
        }
Ejemplo n.º 9
0
        public PresenterBinder(
            IEnumerable <object> hosts,
            IPresenterDiscoveryStrategy presenterDiscoveryStrategy,
            IPresenterFactory presenterFactory,
            ICompositeViewFactory compositeViewFactory,
            IMessageCoordinator messageCoordinator)
        {
            Require.NotNull(hosts, nameof(hosts));
            Require.NotNull(presenterDiscoveryStrategy, nameof(presenterDiscoveryStrategy));
            Require.NotNull(presenterFactory, nameof(presenterFactory));
            Require.NotNull(compositeViewFactory, nameof(compositeViewFactory));
            Require.NotNull(messageCoordinator, nameof(messageCoordinator));

            _hosts = hosts;
            _presenterDiscoveryStrategy = presenterDiscoveryStrategy;
            _presenterFactory           = presenterFactory;
            _compositeViewFactory       = compositeViewFactory;
            _messageCoordinator         = messageCoordinator;

            foreach (var selfHostedView in hosts.OfType <IView>())
            {
                RegisterView(selfHostedView);
            }
        }
Ejemplo n.º 10
0
 public MessageService(IAdmin adminSvc, IMessageCoordinator msgCoordinatorSvc)
 {
     _msgCoordinatorSvc = msgCoordinatorSvc;
     _adminSvc = adminSvc;
 }
Ejemplo n.º 11
0
 public MessageService(IAdmin adminSvc, IMessageCoordinator msgCoordinatorSvc)
 {
     _msgCoordinatorSvc = msgCoordinatorSvc;
     _adminSvc          = adminSvc;
 }
Ejemplo n.º 12
0
 internal NodeLauncher(Networks network, ServiceFlags serviceFlag, IRpcNodeFactory rpcNodeFactory, IBlockChainStore blockChainStore, IMessageCoordinator messageCoordinator, ISmartContractStore smartContractStore)
 {
     _network             = network;
     _serviceFlag         = serviceFlag;
     _p2pNetworkConnector = new P2PNetworkConnector(messageCoordinator);
     _p2pNetworkConnector.ConnectEvent    += P2PConnectEvent;
     _p2pNetworkConnector.DisconnectEvent += P2PDisconnectEvent;
     _p2pNode = new P2PNode(_network, _serviceFlag, _p2pNetworkConnector, messageCoordinator);
     _rpcNode = rpcNodeFactory.Build(_network);
     blockChainStore.Switch(network);
     smartContractStore.Switch(network);
     _blockChain = blockChainStore.GetBlockChain();
 }