public DataPickupService(ILogManager logger, IChannelWriteClient channelWriteClient) { _logger = logger; _dataPickupHandle = new DataPickupHandleService(logger, channelWriteClient); _logger.Info($"{nameof(DataPickupService)} init."); }
/// <summary> /// triggered when the application host is ready to start the service. /// </summary> /// <param name="cancellationToken"></param> /// <returns></returns> public Task StartAsync(CancellationToken cancellationToken) { _logger.Info($"{nameof(DataPickupService)} StartAsync."); try { return(KeepTryingToConnect(cancellationToken)); } catch (Exception ex) { _logger.Error($"{nameof(DataPickupService)} StartAsync. occor error", ex); if (_dataPickupHandle != null) { lock (this) { _dataPickupHandle.Dispose(); _dataPickupHandle = null; } } throw; } }