Exemple #1
0
        public static (IClusterSnapshotControl, ILogger) Instance(World world, string name)
        {
            var initializer = new ClusterSnapshotInitializer(name, Properties.Instance, world.DefaultLogger);

            var application = ClusterApplicationFactory.Instance(world, initializer.LocalNode);

            var control =
                world.ActorFor <IClusterSnapshotControl>(() => new ClusterSnapshotActor(initializer, application), $"cluster-snapshot-{name}");

            return(control, world.DefaultLogger);
        }
        public static (IClusterSnapshotControl, ILogger) Instance(World world, string name)
        {
            var initializer = new ClusterSnapshotInitializer(name, Properties.Instance, world.DefaultLogger);

            var application = ClusterApplicationFactory.Instance(world, initializer.LocalNode);

            var definition =
                Definition.Has <ClusterSnapshotActor>(
                    Definition.Parameters(initializer, application),
                    "cluster-snapshot-" + name);

            var control = world.ActorFor <IClusterSnapshotControl>(definition);

            return(control, world.DefaultLogger);
        }
        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();
        }