Exemple #1
0
        static void Main(string[] args)
        {
            Console.Title = "Node 2";

            var cluster = new TimerCacheCluster();

            cluster.StartClusterNode();

            var system = new ClusterActorSystemService(cluster);

            var timer = new Timer(2000);

            timer.Start();
            timer.Elapsed += (object sender, ElapsedEventArgs e) =>
            {
                //var response = system.GetAnswerFromCluster("Test request").Result;

                //Console.WriteLine($"Response is: {response}");

                Console.WriteLine($"My assests are: {string.Join(",", AssetsCache.Instance.Items)}");
            };

            Console.WriteLine("Any key to exit");

            Console.Read();

            cluster.StopClusterNode();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            var cluster = new TimerCacheCluster();

            cluster.Start();

            var timer = new Timer(2000);

            timer.Elapsed += (object sender, ElapsedEventArgs e) =>
            {
                cluster.SendToAll($"Test child msg from {cluster.Id.ToString()}");
            };
            timer.Start();

            Console.WriteLine("Any key to exit");
            Console.Read();

            cluster.Stop();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            Console.Title = "Seed 2";

            var cluster = new TimerCacheCluster();

            NodeService.OnAdd = cluster.OnNodeAdded;

            cluster.Start();

            var timer = new Timer(2000);

            timer.Elapsed += (object sender, ElapsedEventArgs e) =>
            {
                //cluster.OnNodeAdded(null);
                //cluster.SendToAll("Test child msg");
            };
            timer.Start();

            Console.WriteLine("Any key to exit");
            Console.Read();

            cluster.Stop();
        }