コード例 #1
0
        static void Main(string[] args)
        {
            RedisServices.Init("127.0.0.1", null, string.Empty);

            CommandsAndEventsRegisterEngine.AutoRegister();

            EngineeCommandWorkerQueue.Start();
            EngineeEventWorkerQueue.Start();

            while (true)
            {
                var cmd = Console.ReadLine();
                switch (cmd.ToLower())
                {
                case "quit":
                    _stop = true;
                    Environment.Exit(0);
                    break;

                case "stop":
                    _stop = true;
                    break;

                case "start":
                    _stop = false;
                    MessiveSendCmd();
                    break;
                }
            }
        }
コード例 #2
0
        private static void Run()
        {
            var redishost = ConfigurationManagerExtensions.GetConnectionString("RedisConnectionString");

            RedisServices.Init(redishost, null, string.Empty);

            CommandsAndEventsRegisterEngine.AutoRegister();

            EngineeCommandWorkerQueue.Start();
            EngineeEventWorkerQueue.Start();
            var cmd = (Console.ReadLine() ?? string.Empty).ToLower().Trim();

            while (!cmd.Equals("quit"))
            {
                switch (cmd)
                {
                case "quit":
                    _stop = true;
                    break;

                case "stop":
                    _stop = true;
                    break;

                case "start":
                    _stop = false;
                    MessiveSendCmd(null);
                    break;

                case "pubsub":
                    CommandEventSender.Send(new SampleEventCreated()
                    {
                        PublishedEventId = Guid.NewGuid(),
                        SampleVersion    = DateTime.Now.ToString(),
                        Version          = 0
                    });
                    break;

                case "pubsubmad":
                    _stop = false;
                    MessiveSendCmd(() => {
                        CommandEventSender.Send(new SampleEventCreated()
                        {
                            PublishedEventId = Guid.NewGuid(),
                            SampleVersion    = DateTime.Now.ToString(),
                            Version          = 0
                        });
                    });
                    break;
                }
                cmd = (Console.ReadLine() ?? string.Empty).ToLower().Trim();
            }

            Console.Read();
        }
コード例 #3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            RedisServices.Init("127.0.0.1", null, string.Empty);

            CommandsAndEventsRegisterEngine.AutoRegister();

            EngineeCommandWorkerQueue.Start();
            EngineeEventWorkerQueue.Start();

            services.AddSwagger();
        }
コード例 #4
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors();
            services.AddMvc(option => {
                // option.Filters.Add(new IotHubAuthorizeAttribute());
            }).SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            //RedisServices.Init("172.16.10.166", null, string.Empty);
            var redishost = ConfigurationManagerExtensions.GetConnectionString("RedisConnectionString");

            RedisServices.Init(redishost, null, string.Empty);
            CommandsAndEventsRegisterEngine.AutoRegister();

            EngineeCommandWorkerQueue.Start();
            EngineeEventWorkerQueue.Start();

            services.AddSwagger();
        }