Ejemplo n.º 1
0
        public static void Main()
        {
            Console.WriteLine("Booting cluster might take some time ...\n");

            var config = new ClusterConfiguration().LoadFromEmbeddedResource <Program>("Server.xml");

            Orleankka = ActorSystem.Configure()
                        .Cluster()
                        .From(config)
                        .Register(Assembly.GetExecutingAssembly())
                        .Serializer <NativeSerializer>()
                        .Done();

            HostConfiguration hostConfigs = new HostConfiguration()
            {
                UrlReservations = new UrlReservations()
                {
                    CreateAutomatically = true
                }
            };

            Uri address = new Uri("http://localhost:1234");

            using (var host = new NancyHost(address, new DefaultNancyBootstrapper(), hostConfigs))
            {
                host.Start();
                Console.WriteLine($"API is now accessible via {address}");
            }

            Console.WriteLine("\nPress any key to terminate ...");
            Console.ReadKey(true);

            Orleankka.Dispose();
            Environment.Exit(0);
        }
Ejemplo n.º 2
0
        public override void AfterTest(TestDetails details)
        {
            if (!details.IsSuite)
            {
                return;
            }

            system.Dispose();
        }
Ejemplo n.º 3
0
        public override void Dispose()
        {
            if (domain == null)
            {
                return;
            }

            client.Dispose();
            cluster.Dispose();

            AppDomain.Unload(domain);
            domain = null;
        }
Ejemplo n.º 4
0
        public static void Main(string[] args)
        {
            resume = args.Length == 1 && args[0] == "resume";

            Console.WriteLine("Make sure you've started Azure storage emulator!");
            Console.WriteLine("Running example. Booting cluster might take some time ...\n");

            var account = CloudStorageAccount.DevelopmentStorageAccount;

            SetupTable(account);

            system = ActorSystem.Configure()
                     .Playground()
                     .Register(Assembly.GetExecutingAssembly())
                     .Serializer <NativeSerializer>()
                     .Run <SS.Bootstrap>(new SS.Properties
            {
                StorageAccount = account.ToString(true),
                TableName      = "ssexample"
            })
                     .Done();

            try
            {
                (resume ? Resume() : Run()).Wait();
            }
            catch (AggregateException e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(e.InnerException.Message);
            }

            Console.WriteLine("\nPress any key to terminate ...");
            Console.ReadKey(true);

            system.Dispose();
            Environment.Exit(0);
        }
Ejemplo n.º 5
0
        public static void Main(string[] args)
        {
            resume = args.Length == 1 && args[0] == "resume";

            Console.WriteLine("Make sure you've started Azure storage emulator using \".\\Nake.bat run\"!");
            Console.WriteLine("Running example. Booting cluster might take some time ...\n");

            var account = CloudStorageAccount.DevelopmentStorageAccount;
            SetupTable(account);

            system = ActorSystem.Configure()
                .Playground()
                .Register(Assembly.GetExecutingAssembly())
                .Serializer<NativeSerializer>()
                .Run<SS.Bootstrap>(new SS.Properties
                {
                    StorageAccount = account.ToString(true),
                    TableName = "ssexample"
                })
                .Done();

            try
            {
                (resume ? Resume() : Run()).Wait();
            }
            catch (AggregateException e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(e.InnerException.Message);
            }

            Console.WriteLine("\nPress any key to terminate ...");
            Console.ReadKey(true);

            system.Dispose();
            Environment.Exit(0);
        }