Esempio n. 1
0
        public LocalLiveNodeActor(
            Node node,
            IClusterSnapshot snapshot,
            IRegistry registry,
            IOperationalOutboundStream outbound,
            IConfiguration configuration)
        {
            _node              = node;
            _snapshot          = snapshot;
            _registry          = registry;
            _outbound          = outbound;
            _configuration     = configuration;
            _nodeSynchronizers = new List <INodeSynchronizer>();
            _selfLocalLiveNode = SelfAs <ILocalLiveNode>();
            _checkHealth       = new CheckHealth(_node.Id);
            _cancellable       = ScheduleHealthCheck();

            DeclareIdle();
        }
        public ClusterSnapshotActor(ClusterSnapshotInitializer initializer, IClusterApplication clusterApplication)
        {
            _broadcaster       = new ClusterApplicationBroadcaster(Logger);
            _communicationsHub = initializer.CommunicationsHub;
            _communicationsHub.Open(Stage, initializer.LocalNode, SelfAs <IInboundStreamInterest>(), initializer.Configuration);
            _localNode          = initializer.LocalNode;
            _clusterApplication = clusterApplication;
            _broadcaster.RegisterClusterApplication(clusterApplication);

            _clusterApplication.Start();

            initializer.Registry.RegisterRegistryInterest(SelfAs <IRegistryInterest>());

            _attributesAgent = AttributesAgentFactory.Instance(Stage, _localNode, _broadcaster,
                                                               _communicationsHub.OperationalOutboundStream, initializer.Configuration);

            _localLiveNode = LocalLiveNodeFactory.Instance(Stage, _localNode, SelfAs <IClusterSnapshot>(),
                                                           initializer.Registry, _communicationsHub.OperationalOutboundStream, initializer.Configuration);

            _localLiveNode.RegisterNodeSynchronizer(_attributesAgent);

            _communicationsHub.Start();
        }