コード例 #1
0
        public void SetUp()
        {
            client = new Client();
            client.KV.DeleteTree("/");
            adapter = new ConsulAdapter(client);
            flipper = new Flipper(adapter);

            rubyAdapter = new ConsulRubyAdapter();
        }
コード例 #2
0
        public void SetUp()
        {
            _client = new ConsulClient();
            var pairs = _client.KV.Keys("/", "/").Result;
            foreach (var key in pairs.Response)
            {
                _client.KV.DeleteTree(key).Wait();
            }
            adapter = new ConsulAdapter(_client);
            flipper = new Flipper(adapter);

            rubyAdapter = new ConsulRubyAdapter();
        }
コード例 #3
0
 public ConsulServicesRegistry(IConsulClient client)
 {
     _client = client;
 }
コード例 #4
0
 public SalaryDataController(IConsulClient consulClient)
 {
     this._consulClient = consulClient;
 }
コード例 #5
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IHostingEnvironment env, IApplicationLifetime lifetime, IOptions <ServiceDisvoveryOptions> options, IConsulClient consulClient)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            //启动时注册服务
            lifetime.ApplicationStarted.Register(() =>
            {
                RegisterService(app, options, consulClient);
            });
            //停止的时候移除服务
            lifetime.ApplicationStopped.Register(() =>
            {
                DeRegisterService(app, options, consulClient);
            });

            app.UseCap();

            app.UseAuthentication();

            app.UseMvc();

            UserContextSeed.SeedAsync(app, loggerFactory).Wait();
        }
コード例 #6
0
 public ConsulDiscoveryClient(IConsulClient client)
 {
     this.client = client;
 }
 public ConsulPreparedQueryServiceSubscriber(IConsulClient client, string queryName)
 {
     _client    = client;
     _queryName = queryName;
 }
コード例 #8
0
 public ServiceOperations(IConsulClient client)
 {
     _client = client;
 }
コード例 #9
0
 public ConsulClientWrapper(IConsulClient client)
 {
     _client = client;
 }
コード例 #10
0
 public ConsulHostedService(IConsulClient client, ConsulConfig config)
 {
     _client = client;
     _config = config;
 }
コード例 #11
0
 public ServiceDiscoveryHostedService(IConsulClient client, ServiceConfig config)
 {
     _client = client;
     _config = config;
 }
コード例 #12
0
 public ServiceDiscoveryHostedService(IConsulClient client, IOptions <ConsulConfig> config)
 {
     _client = client;
     _config = config.Value;
 }
コード例 #13
0
 public ConsulRegistry(IConsulClient client)
 {
     this._client = client;
 }
コード例 #14
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime hostApplicationLifetime, IConsulClient consulClient)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });

            //Genera el ID  de consult
            var serviceId = app.UseConsul();

            hostApplicationLifetime.ApplicationStopped.Register(() =>
            {
                consulClient.Agent.ServiceDeregister(serviceId);
            });

            ConfigureEventBus(app);
        }
コード例 #15
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime applicationLifetime, IConsulClient consulClient)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseMvc();
        }
コード例 #16
0
 public ConsulWrapper(IConsulClient consulClient)
 {
     this.consulClient = consulClient;
 }
コード例 #17
0
 public ConsulAdapter(IConsulClient client, string rootNamespace)
 {
     _client = client;
     _namespace = rootNamespace.TrimStart('/');
 }
コード例 #18
0
 public ConsulPreparedQueryServiceSubscriberFactory(IConsulClient consulClient)
 {
     _consulClient = consulClient;
 }
コード例 #19
0
 public new void SetUp()
 {
     Client = new Client();
     Adapter = new ConsulAdapter(Client, Namespace);
     Client.KV.DeleteTree("/");
 }
コード例 #20
0
ファイル: Sessions.cs プロジェクト: devcrafting/microstuff
 public Sessions(IConsulClient consulClient)
 {
     _client = new HttpClient();
     _consulClient = consulClient;
 }
コード例 #21
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IApiVersionDescriptionProvider provider,
                              IHostApplicationLifetime applicationLifetime, IStartupInitializer initializer, IConsulClient consulClient)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            //  app.UseHttpsRedirection();
            //  app.UseCors(builder => builder.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
            initializer.InitializeAsync();
            app.UseRouting();

            //   app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
            app.UseSwaggerBuilder(provider);
            var serviceId = app.UseConsul();

            // Disposing container when application getting stopped.
            applicationLifetime.ApplicationStopped.Register(() =>
            {
                // Once app becomes offline then remove it from consul. Otherwise it will remain in consul service registry
                // as dead service
                consulClient.Agent.ServiceDeregister(serviceId);
                Container.Dispose();
            });
        }
コード例 #22
0
 public ConsulAdapter(IConsulClient client)
 {
     _client = client;
     _namespace = "";
 }
コード例 #23
0
 public ConsulHostedService(IConsulClient consulClient, ILogger <ConsulHostedService> logger, IServer server)
 {
     _consulClient = consulClient;
     _logger       = logger;
     _server       = server;
 }
コード例 #24
0
ファイル: Consul.cs プロジェクト: WS-QA/-Ocelot
 public Consul(ConsulRegistryConfiguration config, IOcelotLoggerFactory factory, IConsulClientFactory clientFactory)
 {
     _logger = factory.CreateLogger <Consul>();
     _config = config;
     _consul = clientFactory.Get(_config);
 }
コード例 #25
0
 public ServiceDiscoveryHostedService(IConsulClient client, IOptions <AbpConsulServiceDiscoveryOptions> options)
 {
     _client = client;
     AbpConsulServiceDiscoveryOptions = options.Value;
 }