Esempio n. 1
0
        /// <summary>
        /// If AlterationMicroservice is stopped by any exceptions or incidents, some IntegrationEvents that are in InQueue status, won't be published on next run of API
        /// this BackgroundService starts once, every time that BackgroundTasks Api starts, and it updates all InQueue statuses to ReadyToPublish
        /// </summary>
        /// <param name="stoppingToken"></param>
        /// <returns></returns>
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            while (!stoppingToken.IsCancellationRequested)
            {
                await Task.Delay(new TimeSpan(0, 0, _taskConfig.Interval), stoppingToken);


                await _backgroundTaskLocalIntegrationEventService.UpdateAllInQueueToProcessToReadyToPublish();


                if (_taskConfig.IsFireAndForget == true)
                {
                    break;
                }
            }
            await Task.CompletedTask;
        }