示例#1
0
        static void Main()
        {
            var azureTableCS = "DefaultEndpointsProtocol=https;AccountName=cs44de867d736aax49dfxbd9;AccountKey=I9QAt4VtgU6UTeJNAtxVCjFijmmMiJNjC032iMUJe2CvVkPxaLWnJYb0AfJuR5AtMpUO6LQ3z43EXOcy4Db+hg==";

            var clusterConfig = ClusterConfiguration.LocalhostPrimarySilo();

            clusterConfig.AddMemoryStorageProvider("Default");
            clusterConfig.AddMemoryStorageProvider("PubSubStore");
            clusterConfig.AddSimpleMessageStreamProvider("SMSProvider");

//            clusterConfig.Globals.LivenessType = GlobalConfiguration.LivenessProviderType.AzureTable;
//            clusterConfig.Globals.DataConnectionString = azureTableCS;
//            clusterConfig.Globals.DataConnectionStringForReminders = azureTableCS;
//            clusterConfig.Globals.DeploymentId = "OrleansTest";
//            clusterConfig.Globals.ReminderServiceType = GlobalConfiguration.ReminderServiceProviderType.AzureTable;

            var silo = new SiloHost("Test Silo", clusterConfig);

            silo.InitializeOrleansSilo();
            silo.StartOrleansSilo();

            Console.WriteLine("Press Enter to close.");
            Console.ReadLine();

            silo.ShutdownOrleansSilo();
        }
示例#2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Please input number:");
            var number = Console.ReadLine();

            Console.Title = "Silo" + number;
            try
            {
                using (var siloHost = new SiloHost(Console.Title))
                {
                    siloHost.ConfigFileName = "OrleansConfiguration" + number + ".xml";;
                    siloHost.LoadOrleansConfig();

                    //siloHost.Config.Globals.LivenessType = GlobalConfiguration.LivenessProviderType.Custom;
                    //siloHost.Config.Globals.MembershipTableAssembly = "OrleansConsulUtils";
                    //siloHost.Config.Globals.ReminderServiceType = GlobalConfiguration.ReminderServiceProviderType.Disabled;

                    siloHost.InitializeOrleansSilo();
                    var startedOk = siloHost.StartOrleansSilo();
                    Console.WriteLine("Silo started successfully");

                    Console.WriteLine("Press enter to exit...");
                    Console.ReadLine();
                    siloHost.ShutdownOrleansSilo();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            Console.ReadLine();
        }
示例#3
0
        static void Main(string[] args)
        {
            // First, configure and start a local silo
            var siloConfig = ClusterConfiguration.LocalhostPrimarySilo();
            var silo       = new SiloHost("TestSilo", siloConfig);

            silo.InitializeOrleansSilo();
            silo.StartOrleansSilo();

            Console.WriteLine("Silo started.");

            // Then configure and connect a client.
            var clientConfig = ClientConfiguration.LocalhostSilo();
            var client       = new ClientBuilder().UseConfiguration(clientConfig).Build();

            client.Connect().Wait();

            Console.WriteLine("Client connected.");

            //---------------------------------------------------------------------------------------
            // Obtain a grain, invoke message and get result
            //---------------------------------------------------------------------------------------
            var hw = client.GetGrain <IGrainGS>(0);

            Console.WriteLine(hw.HellowWorld().Result);


            Console.WriteLine("\nPress Enter to terminate...");
            Console.ReadLine();

            // Shut down
            client.Close();
            silo.ShutdownOrleansSilo();
        }
示例#4
0
        static void Main(string[] args)
        {
            // First, configure and start a local silo
            var siloConfig = ClusterConfiguration.LocalhostPrimarySilo();
            var silo       = new SiloHost("TestSilo", siloConfig);

            silo.InitializeOrleansSilo();
            silo.StartOrleansSilo();

            Console.WriteLine("Silo started.");

            // Then configure and connect a client.
            var clientConfig = ClientConfiguration.LocalhostSilo();
            var client       = new ClientBuilder().UseConfiguration(clientConfig).Build();

            client.Connect().Wait();

            Console.WriteLine("Client connected.");
            //HERE


            //
            var friend = client.GetGrain <ISayHello>(0);

            Console.WriteLine("\n\n{0}\n\n", friend.SayHelloMessage().Result);

            Console.WriteLine("\nPress Enter to terminate...");
            Console.ReadLine();

            // Shut down
            client.Close();
            silo.ShutdownOrleansSilo();
        }
示例#5
0
        static void Main(string[] args)
        {
            Console.Title = "Silo";
            try
            {
                using (var siloHost = new SiloHost(Console.Title))
                {
                    siloHost.ConfigFileName = "OrleansConfiguration.xml";
                    siloHost.LoadOrleansConfig();

                    siloHost.InitializeOrleansSilo();
                    var startedOk = siloHost.StartOrleansSilo();
                    Console.WriteLine("Silo started successfully");

                    Console.WriteLine("Press enter to exit...");
                    Console.ReadLine();
                    siloHost.ShutdownOrleansSilo();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            Console.ReadLine();
        }
示例#6
0
        static void Main(string[] args)
        {
            Console.Title = "ClusterSilo3";
            try
            {
                using (var silo = new SiloHost(Console.Title))
                {
                    silo.ConfigFileName = "OrleansConfiguration.config";

                    silo.LoadOrleansConfig();

                    silo.InitializeOrleansSilo();

                    silo.StartOrleansSilo();

                    Console.WriteLine("Silo start successfully");
                    Console.WriteLine("Press any key to exit");

                    Console.ReadLine();

                    silo.ShutdownOrleansSilo();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"{ex.Message}");
            }
            Console.ReadLine();
        }
示例#7
0
        static void Main(string[] args)
        {
            // First, configure and start a local silo
            siloHost = new SiloHost(System.Net.Dns.GetHostName());
            // The Cluster config is quirky and weird to configure in code, so we're going to use a config file
            siloHost.ConfigFileName = "OrleansConfiguration.xml";

            siloHost.InitializeOrleansSilo();
            siloHost.StartOrleansSilo();



            Metric.Config
            .WithHttpEndpoint("http://localhost:8000/")
            .WithAllCounters();

            Console.WriteLine("Silo started.");



            //
            // This is the place for your test code.
            //

            Console.WriteLine("\nPress Enter to terminate...");
            Console.ReadLine();

            // Shut down
            //client.Close();
            siloHost.ShutdownOrleansSilo();
        }
示例#8
0
        static void Main(string[] args)
        {
            // First, configure and start a local silo
            var siloConfig = ClusterConfiguration.LocalhostPrimarySilo();
            var silo       = new SiloHost("TestSilo", siloConfig);

            silo.InitializeOrleansSilo();
            silo.StartOrleansSilo();

            Console.WriteLine("Silo started.");

            // Then configure and connect a client.
            var clientConfig = ClientConfiguration.LocalhostSilo();
            var client       = new ClientBuilder().UseConfiguration(clientConfig).Build();

            client.Connect().Wait();

            Console.WriteLine("Client connected.");

            //
            // This is the place for your test code.
            //

            Console.WriteLine("\nPress Enter to terminate...");
            Console.ReadLine();

            // Shut down
            client.Close();
            silo.ShutdownOrleansSilo();
        }
 public bool Stop()
 {
     if (startup.Status == TaskStatus.RanToCompletion)
     {
         host.ShutdownOrleansSilo();
     }
     return(true);
 }
        public static void Main(string[] args)
        {
            CreateWebHostBuilder(args).Build().Run();

            // First, configure and start a local silo
            var siloConfig = ClusterConfiguration.LocalhostPrimarySilo();
            var silo       = new SiloHost("TestSilo", siloConfig);

            silo.InitializeOrleansSilo();
            silo.StartOrleansSilo();

            Console.WriteLine("Silo started.");

            // Then configure and connect a client.
            var clientConfig = ClientConfiguration.LocalhostSilo();
            var client       = new ClientBuilder().UseConfiguration(clientConfig).Build();

            client.Connect().Wait();

            Console.WriteLine("Client connected.");

            //
            var saludo    = client.GetGrain <MergeInterface.IMergeSort>(Guid.NewGuid());
            var resultado = ReadFileYeah(@"C: \Users\Chino Guzman\source\repos\DistributedMergeSort\oraciones.txt").ToList();

            /*var valores = decoder(resultado);
             * var resultadofinal = MergeSort(saludo, 0, valores, 1, valores.Count);
             * foreach(List<int> x in resultadofinal)
             * {
             *  Console.WriteLine(x[0]);
             * }
             * var valoresfinales = encoder(resultadofinal);
             * foreach (char[] x in valoresfinales) {
             *  foreach (char hola in x) {
             *      Console.Write(hola);
             *  }
             *  Console.WriteLine("");
             * }*/

            var yeah = MergeSort(saludo, resultado, 1, resultado.Count);

            foreach (string x in yeah)
            {
                Console.WriteLine(x);
            }

            Console.WriteLine("\nPress Enter to terminate...");
            Console.ReadLine();

            // Shut down
            client.Close();
            silo.ShutdownOrleansSilo();
        }
示例#11
0
        static void Main(string[] args)
        {
            // First, configure and start a local silo
            var siloConfig = ClusterConfiguration.LocalhostPrimarySilo();

            siloConfig.AddSimpleMessageStreamProvider(Common.Constants.InboundTransmissionStreamProvider);
            siloConfig.AddSimpleMessageStreamProvider(Common.Constants.OutboundTransmissionStreamProvider);
            var silo = new SiloHost("TestSilo", siloConfig);

            silo.Config.AddMemoryStorageProvider("PubSubStore");
            silo.InitializeOrleansSilo();
            silo.StartOrleansSilo();

            Console.WriteLine("Silo started.");

            // Then configure and connect a client.
            var clientConfig = ClientConfiguration.LocalhostSilo();

            clientConfig.AddSimpleMessageStreamProvider(Common.Constants.InboundTransmissionStreamProvider);
            clientConfig.AddSimpleMessageStreamProvider(Common.Constants.OutboundTransmissionStreamProvider);
            var client = new ClientBuilder().UseConfiguration(clientConfig).Build();

            client.Connect().Wait();

            Console.WriteLine("Client connected.");

            //
            // This is the place for your test code.
            //
            var transport = new Transport();

            var inboundSubscription = transport.Received
                                      .Subscribe(datagram => client.InboundTransmissionStream(datagram.IpAddress).OnNextAsync(datagram));

            var outboundSubscription = client.OutboundTransmissionStream()
                                       .SubscribeAsync((datagram, token) => transport.Send(datagram))
                                       .Result;

            var connection = transport.Connect();

            Console.WriteLine("\nPress Enter to terminate...");
            Console.ReadLine();
            Console.WriteLine("\nTerminating...");

            inboundSubscription.Dispose();
            outboundSubscription.UnsubscribeAsync().Wait();

            // Shut down
            client.Close();
            silo.ShutdownOrleansSilo();
        }
示例#12
0
        static void Main(string[] args)
        {
            // First, configure and start a local silo
            var siloConfig = ClusterConfiguration.LocalhostPrimarySilo();

            siloConfig.Globals.RegisterStorageProvider <MemoryStorage>("OrleansStorage");
            siloConfig.Globals.Application.SetDefaultCollectionAgeLimit(ageLimit: TimeSpan.FromMinutes(1));

            siloConfig.Globals.Application.SetCollectionAgeLimit(type: typeof(LinkStage0Grain), ageLimit: TimeSpan.FromMinutes(1));
            siloConfig.Globals.Application.SetCollectionAgeLimit(type: typeof(LinkStage1Grain), ageLimit: TimeSpan.FromMinutes(2));
            siloConfig.Globals.Application.SetCollectionAgeLimit(type: typeof(LinkStage2Grain), ageLimit: TimeSpan.FromMinutes(3));

            var logger = new Serilog.LoggerConfiguration()
                         .WriteTo.Console()
                         .CreateLogger();
            var serilogConsumer = new SerilogConsumer(logger);

            LogManager.LogConsumers.Add(serilogConsumer);
            //LogManager.TelemetryConsumers.Add(serilogConsumer);

            var silo = new SiloHost("TestSilo", siloConfig);

            silo.InitializeOrleansSilo();
            silo.StartOrleansSilo();

            Console.WriteLine("Silo started.");

            // Then configure and connect a client.
            var clientConfig = ClientConfiguration.LocalhostSilo();
            var client       = new ClientBuilder().UseConfiguration(clientConfig).Build();

            client.Connect().Wait();

            Console.WriteLine("Client connected.");


            ////
            //// This is the place for your test code.
            ////

            //ClientCall(clientConfig, client);


            Console.WriteLine("\nPress Enter to terminate...");
            Console.ReadLine();

            // Shut down
            //client.Close();
            silo.ShutdownOrleansSilo();
        }
示例#13
0
        static void Main(string[] args)
        {
            // First, configure and start a local silo
            var siloConfig = ClusterConfiguration.LocalhostPrimarySilo();

            siloConfig.UseStartupType <TestStartup>(); // inject our custom service


            var silo = new SiloHost("TestSilo", siloConfig);

            silo.InitializeOrleansSilo();
            silo.StartOrleansSilo();

            Console.WriteLine("Silo started.");

            // Then configure and connect a client.
            var clientConfig = ClientConfiguration.LocalhostSilo();
            var client       = new ClientBuilder().UseConfiguration(clientConfig).Build();

            client.Connect().Wait();

            Console.WriteLine("Client connected.");
            //
            // This is the place for your test code.
            //


            var hiGrain  = client.GetGrain <IHello>(0);
            var hiGrain1 = client.GetGrain <IHello>(1);
            var hiGrain2 = client.GetGrain <IHello>(2);

            Console.WriteLine("0.");
            hiGrain.SayHello("ss");
            Console.WriteLine("1.");
            hiGrain1.SayHello("ss1");
            Console.WriteLine("2.");
            hiGrain2.SayHello("ss2");
            Console.WriteLine("3.");
            var result = hiGrain.SayHello("pik pik").Result;

            Console.WriteLine(result);

            Console.WriteLine("\nPress Enter to terminate...");
            Console.ReadLine();

            // Shut down
            client.Close();
            silo.ShutdownOrleansSilo();
        }
示例#14
0
        static void Main(string[] args)
        {
            var siloConfig = ClusterConfiguration.LocalhostPrimarySilo();
            var silo       = new SiloHost("Test Silo", siloConfig);

            silo.InitializeOrleansSilo();
            silo.StartOrleansSilo();

            Console.WriteLine("Press Enter to close Silo.");
            // wait here
            Console.ReadLine();

            // shut the silo down after we are done.
            silo.ShutdownOrleansSilo();
        }
示例#15
0
        static void Main(string[] args)
        {
            var siloConfig = ClusterConfiguration.LocalhostPrimarySilo();

            siloConfig.Defaults.DefaultTraceLevel = Severity.Warning;
            var silo = new SiloHost("Test Silo", siloConfig);

            silo.InitializeOrleansSilo();
            silo.StartOrleansSilo();

            Console.WriteLine("Orleans Silo is running.\nPress Enter to terminate...");
            Console.ReadLine();

            silo.ShutdownOrleansSilo();
        }
        public bool Stop()
        {
            try
            {
                _silo.ShutdownOrleansSilo();
                _silo.WaitForOrleansSiloShutdown();
            }
            catch (Exception exception)
            {
                _silo.ReportStartupError(exception);
                Console.WriteLine(exception);

                return(false);
            }
            return(true);
        }
示例#17
0
        static void Main(string[] args)
        {
            // First, configure and start a local silo
            var siloConfig = ClusterConfiguration.LocalhostPrimarySilo();
            var silo       = new SiloHost("TestSilo", siloConfig);

            silo.InitializeOrleansSilo();
            silo.StartOrleansSilo();

            Console.WriteLine("Silo started.");

            // Then configure and connect a client.
            var clientConfig = ClientConfiguration.LocalhostSilo();
            var client       = new ClientBuilder().UseConfiguration(clientConfig).Build();

            client.Connect().Wait();

            Console.WriteLine("Client connected.");

            GrainClient.Initialize(ClientConfiguration.LocalhostSilo());
            var grain = GrainClient.GrainFactory.GetGrain <IGIFSGrain>(1);

            //Se define el objeto objRemoto para referenciar el grain de la interfaz IGIFSGrain del SILO
            //IGIFSGrain objRemoto = client.GetGrain<IGIFSGrain>(1);

            //Definimos el DataSet oDS y registramos en el mismo, el DataSet de noticias de la cache, que se
            //obtiene del método "LeerNoticias", declarado en el SILO

            grain.CargarGIFSALaCache().Wait();
            DataSet oDS = grain.LeerGIFSDesdeLaCache().Result;

            Console.WriteLine(oDS.Tables.Count.ToString());

            //
            // This is the place for your test code.
            //

            Console.WriteLine("\nPress Enter to terminate...");
            Console.ReadLine();

            // Shut down
            client.Close();
            silo.ShutdownOrleansSilo();
        }
        public bool Stop()
        {
            bool ok = false;

            try
            {
                _siloHost.ShutdownOrleansSilo();

                Console.WriteLine($"Orleans silo '{_siloHost.Name}' shutdown.");
            }
            catch (Exception exc)
            {
                _siloHost.ReportStartupError(exc);
                var msg = $"{exc.GetType().FullName}:\n{exc.Message}\n{exc.StackTrace}";
                Console.WriteLine(msg);
            }

            return(ok);
        }
示例#19
0
        public bool Stop()
        {
            bool ok = false;

            try
            {
                siloHost.ShutdownOrleansSilo();

                Console.WriteLine(string.Format("Orleans silo '{0}' shutdown.", siloHost.Name));
            }
            catch (Exception exc)
            {
                siloHost.ReportStartupError(exc);
                var msg = string.Format("{0}:\n{1}\n{2}", exc.GetType().FullName, exc.Message, exc.StackTrace);
                Console.WriteLine(msg);
            }

            return(ok);
        }
示例#20
0
        static void Main(string[] args)
        {
            var silo = new SiloHost("Silo");

            silo.ConfigFileName = "SiloConfiguration.xml";

            silo.InitializeOrleansSilo();
            var startSuccessful = silo.StartOrleansSilo();

            if (!startSuccessful)
            {
                throw new SystemException(String.Format("Failed to start Orleans silo '{0}' as a {1} node", silo.Name, silo.Type));
            }

            Console.WriteLine("\nPress Enter to terminate...");
            Console.ReadLine();

            silo.ShutdownOrleansSilo();
        }
示例#21
0
        static void Main(string[] args)
        {
            // First, configure and start a local silo
            var siloConfig = ClusterConfiguration.LocalhostPrimarySilo();
            var silo       = new SiloHost("TestSilo", siloConfig);

            silo.InitializeOrleansSilo();
            silo.StartOrleansSilo();

            Console.WriteLine("Silo started.");

            // Then configure and connect a client.
            var clientConfig = ClientConfiguration.LocalhostSilo();

            clientConfig.SerializationProviders.Add(typeof(Orleans.Serialization.BondSerializer).GetTypeInfo());

            var client = new ClientBuilder().UseConfiguration(clientConfig).Build();

            client.Connect().Wait();

            Console.WriteLine("Client connected.");

            //
            // This is the place for your test code.
            //
            //var xxxx = new ClientConfiguration();
            //xxxx.GatewayProvider = ClientConfiguration.GatewayProviderType.None;
            //xxxx.Gateways.Add(new System.Net.IPEndPoint(IPAddress.Parse("127.0.0.1"), 40000));
            //GrainClient.Initialize(xxxx);

            //var gw = GrainClient.GrainFactory.GetGrain<IGateway>("gw1");
            //var succ = gw.Start().Result;

            //initThrift(gw);


            Console.WriteLine("\nPress Enter to terminate...");
            Console.ReadLine();

            // Shut down
            client.Close();
            silo.ShutdownOrleansSilo();
        }
示例#22
0
        static void Main(string[] args)
        {
            // First, configure and start a local silo
            var siloConfig = ClusterConfiguration.LocalhostPrimarySilo();
            var silo       = new SiloHost("TestSilo", siloConfig);

            silo.InitializeOrleansSilo();
            silo.StartOrleansSilo();

            Console.WriteLine("Silo started.");

            // Then configure and connect a client.
            var clientConfig = ClientConfiguration.LocalhostSilo();
            var client       = new ClientBuilder().UseConfiguration(clientConfig).Build();

            client.Connect().Wait();

            Console.WriteLine("Client connected.");

            //
            // This is the place for your test code.
            //
            Console.WriteLine("Step1");
            var grain = client.GetGrain <IStockGrain>("MSFT");

            Console.WriteLine("Step2");
            var price = grain.GetPrice().Result;

            Console.WriteLine("Step3");
            Console.WriteLine("P:" + price.ToString());

            //输出结果:先输出 Step1 step2,过10s过后输出Step3
            //因为StockGrain的OnActivateAsync是异步函数,所有GetGrain会快速返回。
            //StockGrain只有处理完OnActivateAsync函数过后,才会处理GetPrice.

            Console.WriteLine("\nPress Enter to terminate...");
            Console.ReadLine();

            // Shut down
            client.Close();
            silo.ShutdownOrleansSilo();
        }
示例#23
0
        static void Main(string[] args)
        {
            var siloConfig = ClusterConfiguration.LocalhostPrimarySilo();

            siloConfig
            .SimpleMessageStreamProvider(FluentConfig.AltNetStream);
            siloConfig.Defaults.DefaultTraceLevel = Severity.Error;


            var silo = new SiloHost("Alt.NET Demo Silo", siloConfig);

            silo.InitializeOrleansSilo();
            silo.StartOrleansSilo();

            Console.WriteLine("Press Enter to close.");
            Console.ReadLine();

            // shut the silo down after we are done.
            silo.ShutdownOrleansSilo();
        }
示例#24
0
        static void Main(string[] args)
        {
            // First, configure and start a local silo
            var siloConfig = ClusterConfiguration.LocalhostPrimarySilo();

            siloConfig.AddMemoryStorageProvider();

            var silo = new SiloHost("TestSilo", siloConfig);

            silo.InitializeOrleansSilo();
            silo.StartOrleansSilo();

            Console.WriteLine("Silo started.");

            Console.WriteLine("\nPress Enter to terminate...");
            Console.ReadLine();

            // Shut down
            silo.ShutdownOrleansSilo();
        }
        static void Main(string[] args)
        {
            // First, configure and start a local silo
            var siloConfig = ClusterConfiguration.LocalhostPrimarySilo();
            var silo       = new SiloHost("TestSilo", siloConfig);

            silo.InitializeOrleansSilo();
            silo.StartOrleansSilo();

            Console.WriteLine("Silo started.");

            // Then configure and connect a client.
            var clientConfig = ClientConfiguration.LocalhostSilo();
            var client       = new ClientBuilder().UseConfiguration(clientConfig).Build();

            client.Connect().Wait();

            Console.WriteLine("Client connected.");

            int numberOfGrains = 200;

            var tasks = new Task[numberOfGrains];

            for (int i = 0; i < numberOfGrains; i++)
            {
                var           friend = client.GetGrain <IGrain1>(i);
                Task <string> task   = friend.SayHello();
                var           taskId = i;
                task.ContinueWith(helloTask => { Console.WriteLine($"{taskId}: {helloTask.Result}"); });
                tasks[i] = task;
            }

            Task.WaitAll(tasks);

            Console.WriteLine("\nPress Enter to terminate...");
            Console.ReadLine();

            // Shut down
            client.Close();
            silo.ShutdownOrleansSilo();
        }
示例#26
0
文件: Program.cs 项目: cdjchyg/wind
        static void Main(string[] args)
        {
            // First, configure and start a local silo
            var siloConfig = ClusterConfiguration.LocalhostPrimarySilo();
            var silo       = new SiloHost("TestSilo", siloConfig);

            silo.InitializeOrleansSilo();
            silo.StartOrleansSilo();

            Console.WriteLine("Silo started.");

            //
            // This is the place for your test code.
            //

            Console.WriteLine("\nPress Enter to terminate...");
            Console.ReadKey();

            // Shut down
            silo.ShutdownOrleansSilo();
        }
示例#27
0
        /// <summary>
        /// Stop and dispose of running SiloHost
        /// </summary>
        /// <returns></returns>
        public int Stop()
        {
            if (_siloHost == null)
            {
                throw new OrleansException("There is no silo server running to stop");
            }

            try
            {
                _siloHost.ShutdownOrleansSilo();
                _siloHost.Dispose();

                Console.WriteLine($"Successfully stopped silo server {_siloHost.Name}");
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex);
                return(1);
            }

            return(0);
        }
示例#28
0
        static void Main(string[] args)
        {
            //CONFIGURACIÓN SILO (cluster) LOCAL
            var siloConfig = ClusterConfiguration.LocalhostPrimarySilo();
            var silo       = new SiloHost("TestSilo", siloConfig);

            silo.InitializeOrleansSilo();
            silo.StartOrleansSilo();

            Console.WriteLine("SILO INICIADO EXITÓSAMENTE.");

            //CONFIGURACIÓN CLIENTE
            var clientConfig = ClientConfiguration.LocalhostSilo();
            var client       = new ClientBuilder().UseConfiguration(clientConfig).Build();

            client.Connect().Wait();

            Console.WriteLine("CLIENTE CONECTADO EXITÓSAMENTE");

            //LLAMADA DEL GRANO (actor) INICIAL, este no se usa para la distribución per se
            var principal = client.GetGrain <MergeInterface.IMergeSort>(Guid.NewGuid());
            var resultado = ReadFileYeah(Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName, "oraciones.txt")).ToList();

            //CÁLCULO BÁSICO DE DISTRIBUCIÓN (el primer parámetro es arbitrario)
            var identificadores = distribucion(100, client, resultado);

            //LLAMADA CENTRAL DE MERGE SORT
            var yeah = MergeSort(client, identificadores, identificadores.Count, principal, resultado, 1, resultado.Count);

            WriteFileYeah(Path.Combine(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName, "oraciones.txt"), yeah);

            Console.WriteLine("\nPress Enter to terminate...");
            Console.ReadLine();

            // Shut down
            client.Close();
            silo.ShutdownOrleansSilo();
        }
示例#29
0
        static void Main(string[] args)
        {
            var siloConfig = ClusterConfiguration.LocalhostPrimarySilo(2233, 1234);
            var silo       = new SiloHost("TestSilo", siloConfig);

            silo.InitializeOrleansSilo();
            silo.StartOrleansSilo();

            //检查一下
            if (silo.IsStarted)
            {
                Console.WriteLine("silohost 启动成功");
            }
            else
            {
                Console.WriteLine("启动失败");
            }
            Console.WriteLine("\n按回车键结束...");
            Console.ReadLine();

            // Shut down
            silo.ShutdownOrleansSilo();
        }
示例#30
0
        private static void Main(string[] args)
        {
            // First, configure and start a local silo
            var siloConfig = ClusterConfiguration.LocalhostPrimarySilo(22222, 40000);
            var silo       = new SiloHost("TestSilo", siloConfig);

            //silo.ConfigFileName = "SiloHostConfiguration.xml";
            silo.InitializeOrleansSilo();
            silo.StartOrleansSilo();

            Console.WriteLine("Silo started.");

            //// Then configure and connect a client.
            //var clientConfig = ClientConfiguration.LocalhostSilo();
            //var client = new ClientBuilder().UseConfiguration(clientConfig).Build();
            //client.Connect().Wait();

            //Console.WriteLine("Client connected.");

            //
            // This is the place for your test code.
            //

            //GrainClient.Initialize(clientConfig);
            //var friend = GrainClient.GrainFactory.GetGrain<IHello>(Guid.NewGuid());
            //var result = friend.SayHello("Goodbye").Result;
            //Console.WriteLine(result);



            Console.WriteLine("\nPress Enter to terminate...");
            Console.ReadLine();

            // Shut down
            //client.Close();
            silo.ShutdownOrleansSilo();
        }