Ejemplo n.º 1
0
            public ApplicationLifecycle(IApplicationLifetime lifeCycle, IDiscoveryClient client)
            {
                ApplicationStopping = lifeCycle.ApplicationStopping;

                // hook things up so that that things are unregistered when the application terminates
                ApplicationStopping.Register(() => { client.ShutdownAsync().GetAwaiter().GetResult(); });
            }
        internal async Task ProvideRuntimeReplacementsAsync(IDiscoveryClient discoveryClientFromDI, ILoggerFactory loggerFactory)
        {
            if (discoveryClientFromDI is not null)
            {
                _logger.LogInformation("Replacing the IDiscoveryClient built at startup with one for runtime");
                await _discoveryClient.ShutdownAsync().ConfigureAwait(false);

                _discoveryClient             = discoveryClientFromDI;
                _usingInitialDiscoveryClient = false;
            }

            if (loggerFactory is not null)
            {
                _logFactory = loggerFactory;
                _logger     = loggerFactory.CreateLogger <ConfigServerDiscoveryService>();
            }
        }
Ejemplo n.º 3
0
 protected void Application_End()
 {
     //释放客户端
     _client.ShutdownAsync();
 }
Ejemplo n.º 4
0
 protected void Application_End()
 {
     // Unregister current app with Service Discovery server
     _client.ShutdownAsync();
 }
Ejemplo n.º 5
0
 public Task StopAsync(CancellationToken cancellationToken)
 {
     return(_discoveryClient.ShutdownAsync());
 }