public async Task Handle(IList <RecordPeriodEndStopJob> messages, CancellationToken cancellationToken)
        {
            foreach (var message in messages)
            {
                logger.LogInfo($"Handling period end stop job: {message.ToJson()}");
                await periodEndJobService.RecordPeriodEndJob(message, cancellationToken);

                jobStatusManager.StartMonitoringJob(message.JobId, JobType.PeriodEndStopJob);
                logger.LogInfo($"Handled period end stop job: {message.JobId}");
            }
        }
Beispiel #2
0
        public async Task Handle(IList <RecordPeriodEndSubmissionWindowValidationJob> messages, CancellationToken cancellationToken)
        {
            foreach (var message in messages)
            {
                var stopwatch = new Stopwatch();
                stopwatch.Start();

                logger.LogInfo($"Handling period end submission window validation job: {message.ToJson()}");

                await periodEndJobService.RecordPeriodEndJob(message, cancellationToken);

                var metricsValid = await submissionWindowValidationClient.Validate(message.JobId, message.CollectionYear, message.CollectionPeriod);

                var jobStatus = metricsValid ? JobStatus.Completed : JobStatus.CompletedWithErrors;

                await jobStorageService.SaveJobStatus(message.JobId, jobStatus, DateTimeOffset.Now, cancellationToken);

                logger.LogInfo($"Handled period end submission window validation job: {message.JobId}");

                stopwatch.Stop();

                SendTelemetry(message, jobStatus, stopwatch.Elapsed);
            }
        }