コード例 #1
0
ファイル: ChicagoServer.cs プロジェクト: Sharelink/Chicago
        protected override void ServerInit()
        {
            base.ServerInit();
            Instance = this;
            var psClientMgr = DBClientManagerBuilder.GenerateRedisConnectionMultiplexer(Program.Configuration.GetSection("Data:MessagePubSubServer"));
            BahamutPubSubService = new BahamutPubSubService(psClientMgr);

            var tokenServerClientManager = DBClientManagerBuilder.GenerateRedisConnectionMultiplexer(Program.Configuration.GetSection("Data:TokenServer"));
            TokenService = new TokenService(tokenServerClientManager);
        }
コード例 #2
0
ファイル: Startup.cs プロジェクト: Sharelink/Toronto
        // This method gets called by a runtime.
        // Use this method to add services to the container
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc(config => {
                config.Filters.Add(new BahamutAspNetCommon.LogExceptionFilter());
            }).AddJsonOptions(op =>
            {
                op.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
            });

            var tokenServerUrl = Configuration["Data:TokenServer:url"].Replace("redis://", "");
            var TokenServerClientManager = new PooledRedisClientManager(tokenServerUrl);

            var serverControlUrl = Configuration["Data:ControlServiceServer:url"].Replace("redis://", "");
            var ControlServerServiceClientManager = new PooledRedisClientManager(serverControlUrl);
            services.AddSingleton(new ServerControlManagementService(ControlServerServiceClientManager));
            services.AddSingleton(new TokenService(TokenServerClientManager));

            var pubsubServerUrl = Configuration["Data:MessagePubSubServer:url"].Replace("redis://", "");
            var pbClientManager = new PooledRedisClientManager(pubsubServerUrl);

            var messageCacheServerUrl = Configuration["Data:MessageCacheServer:url"].Replace("redis://", "");
            var mcClientManager = new PooledRedisClientManager(messageCacheServerUrl);
            var bcService = new BahamutCacheService(mcClientManager);
            services.AddSingleton(bcService);

            var pbService = new BahamutPubSubService(pbClientManager);
            services.AddSingleton(pbService);
        }