コード例 #1
0
ファイル: Program.cs プロジェクト: qiao2015/Orleans-1
        static void Main(string[] args)
        {
            var config = new Orleans.Runtime.Configuration.ClusterConfiguration();

            config.LoadFromFile("Host.xml");
            //SiloHost siloHost = new SiloHost(System.Net.Dns.GetHostName());
            //初始化一个silohost,这里使用了Orleans提供的silohost而不是silo,其中silo的名字命名为Ba;
            Orleans.Runtime.Host.SiloHost siloHost = new Orleans.Runtime.Host.SiloHost("Ba", config);
            //初始化仓储
            siloHost.InitializeOrleansSilo();
            //启动
            siloHost.StartOrleansSilo();

            //检查一下
            if (siloHost.IsStarted)
            {
                Console.WriteLine("silohost 启动成功");
            }
            else
            {
                Console.WriteLine("启动失败");
            }
            Console.ReadKey();


            //关闭silo
            siloHost.StopOrleansSilo();
            //未初始化这个silo    (搞不懂啥意思)
            siloHost.UnInitializeOrleansSilo();
            //优雅的关闭这个silo
            siloHost.ShutdownOrleansSilo();
            Console.ReadKey();
        }
コード例 #2
0
 private void AdjustConfig(Orleans.Runtime.Configuration.ClusterConfiguration c)
 {
     c.Globals.RegisterStorageProvider <Orleans.Storage.OrleansCouchBaseStorage>("Default",
                                                                                 new Dictionary <string, string>()
     {
         { "Server", "http://localhost:8091" },
         { "UserName", "" },
         { "Password", "" },
         { "BucketName", "default" }
     });
 }
コード例 #3
0
 public static void TestInitialize()
 {
     if (host == null)
     {
         var clusterConfiguration = new Orleans.Runtime.Configuration.ClusterConfiguration();
         clusterConfiguration.LoadFromFile("OrleansServerConfiguration.xml");
         var clientConfiguration = Orleans.Runtime.Configuration.ClientConfiguration.LoadFromFile("OrleansClientConfiguration.xml");
         host = new TestCluster(clusterConfiguration, clientConfiguration);
         host.Deploy();
     }
 }
コード例 #4
0
ファイル: Program.cs プロジェクト: syxdevcode/OrleansDemo
        static void Main(string[] args)
        {
            //获得一个配置实例
            //它需要两个端口,第一个端口2234是用来silo与silo之间的通信的,第二个1234是用于监听client的请求的
            //var config = Orleans.Runtime.Configuration.ClusterConfiguration.LocalhostPrimarySilo(2234, 1234);

            //使用配置文件
            var config = new Orleans.Runtime.Configuration.ClusterConfiguration();

            config.LoadFromFile("host.xml");

            //初始化一个silohost,这里使用了Orleans提供的silohost而不是silo,其中silo的名字命名为Ba;
            Orleans.Runtime.Host.SiloHost silohost = new Orleans.Runtime.Host.SiloHost("Ba", config);

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

            silohost.InitializeOrleansSilo();

            silohost.StartOrleansSilo();

            //检查一下
            if (silohost.IsStarted)
            {
                Console.WriteLine("siloHost 启动成功");
            }
            else
            {
                Console.WriteLine("启动失败");
            }

            Console.ReadKey();

            // 关闭,停止
            silohost.StopOrleansSilo();
            silohost.UnInitializeOrleansSilo();
            silohost.ShutdownOrleansSilo();
        }