public async Task StartAsync(CancellationToken cancellationToken)
 {
     _lifetime.ApplicationStarted.Register(delegate
     {
         _serviceDiscoveryProvider.Register();
     });
     _lifetime.ApplicationStopping.Register(delegate
     {
         _serviceDiscoveryProvider.Deregister();
     });
 }
Example #2
0
        public async Task StartAsync(CancellationToken cancellationToken)
        {
            _lifetime.ApplicationStarted.Register(delegate
            {
                _serviceDiscoveryProvider.Register();

                _timer.Elapsed += delegate
                {
                    _serviceDiscoveryProvider.Heartbeat();
                };
                _timer.Start();
            });
            _lifetime.ApplicationStopping.Register(delegate
            {
                _timer.Stop();
                _serviceDiscoveryProvider.Deregister();
            });
        }