public ClusterSnapshotActorTest(ITestOutputHelper output) : base(output)
        {
            _intializer = new ClusterSnapshotInitializer("node1", Properties, TestWorld.DefaultLogger);

            var messageBuffer = new MemoryStream(4096);
            var pulse         = new Pulse(Id.Of(1));

            MessageConverters.MessageToBytes(pulse, messageBuffer);
            _opMessage = Id.Of(1).Value.ToRawMessage(messageBuffer);
        }
Beispiel #2
0
        public void TestCreate()
        {
            var initializer = new ClusterSnapshotInitializer("node1", Properties, TestWorld.DefaultLogger);

            Assert.NotNull(initializer);
            Assert.NotNull(initializer.CommunicationsHub);
            Assert.NotNull(initializer.Configuration);
            Assert.NotNull(initializer.LocalNode);
            Assert.Equal(1, initializer.LocalNode.Id.Value);
            Assert.NotNull(initializer.LocalNodeId);
            Assert.Equal(1, initializer.LocalNodeId.Value);
            Assert.NotNull(initializer.Registry);
        }
    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();
        _clusterApplication.InformResponder(_communicationsHub.ApplicationOutboundStream);

        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();
    }