private void DoWork()
        {
            while (true)
            {
                try
                {
                    var currentRoleInstance = RoleEnvironment.CurrentRoleInstance("JobWorker", containerId);
                    var brotherInstances    = RoleEnvironment.BrotherInstances;

                    Console.WriteLine($"{DateTime.Now}:");
                    Console.WriteLine($"Current role instance: {currentRoleInstance}");
                    Console.WriteLine("Brother instances: ");
                    if (brotherInstances != null)
                    {
                        foreach (var brother in brotherInstances)
                        {
                            Console.WriteLine(brother);
                        }
                    }
                    Console.WriteLine();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                }

                Thread.Sleep(10000);
            }
        }
Ejemplo n.º 2
0
        public void Start(string containerId)
        {
            Console.WriteLine("Pokrecem Start metodu");
            Console.WriteLine($"ContainerId = {containerId}");

            while (true)
            {
                Console.WriteLine($"Current Role Instance: {RoleEnvironment.CurrentRoleInstance("Class1", containerId)}");
                RoleEnvironment.BrotherInstances.ToList().ForEach(i => Console.WriteLine(i));
                Thread.Sleep(5000);
            }
        }