Exemple #1
0
        /// <summary>
        /// Start the Host in the background,
        /// the Task completes when the host is ready to accept connections
        /// </summary>
        public async Task Start()
        {
            TheEngine = await Engine.Start <TModel>();

            _server = new MemstateServer <TModel>(TheEngine);
            _server.Start();
            await StartWebConsole();
        }
Exemple #2
0
        private static void RunServer()
        {
            Console.WriteLine("Starting server on port 3001, type exit to quit");
            MemstateSettings config = new MemstateSettings();

            config.StorageProvider = typeof(InMemoryStorageProvider).FullName;
            config.LoggerFactory.AddConsole((category, level) => true);
            var engine = new EngineBuilder(config).Build <KeyValueStore <int> >();
            var server = new MemstateServer <KeyValueStore <int> >(config, engine);

            server.Start();
            while (Console.ReadLine() != "exit")
            {
                Console.WriteLine("Type exit to quit");
            }
            server.Stop();
            Console.WriteLine("Server stopped, hit enter to terminate");
            Console.ReadLine();
        }
Exemple #3
0
        private static Task RunServer()
        {
            Console.WriteLine("Starting server on port 3001, type exit to quit");
            var settings = new MemstateSettings
            {
                FileSystem = new InMemoryFileSystem()
            };

            settings.LoggerFactory.AddConsole((category, level) => true);
            var engine = new EngineBuilder(settings).Build <KeyValueStore <int> >();
            var server = new MemstateServer <KeyValueStore <int> >(settings, engine);

            server.Start();
            while (Console.ReadLine() != "exit")
            {
                Console.WriteLine("Type exit to quit");
            }
            server.Stop();
            Console.WriteLine("Server stopped, hit enter to terminate");
            Console.ReadLine();

            return(Task.CompletedTask);
        }
Exemple #4
0
 private static void Start <T>(MemstateServer <T> server) where T : class
 {
     server.Start();
 }