Beispiel #1
0
        public async Task Handle(PeriodEndStoppedEvent message, IMessageHandlerContext context)
        {
            logger.LogInfo($"Processing Month End Period End Stopped Event with Message Id : {context.MessageId}");

            var currentExecutionContext = (ESFA.DC.Logging.ExecutionContext)executionContext;

            currentExecutionContext.JobId = message.JobId.ToString();

            await collectionPeriodStorageService.StoreCollectionPeriod(message);

            var commands = await completionPaymentService.GenerateProviderMonthEndAct1CompletionPaymentCommands(message).ConfigureAwait(false);

            if (!commands.Any())
            {
                logger.LogWarning($"No Providers found with Act1 Completion payments for Collection Period: {message.CollectionPeriod.Period:00}-{message.CollectionPeriod.AcademicYear}, job: {message.JobId}");
                return;
            }

            foreach (var command in commands)
            {
                logger.LogDebug($"Sending Process Provider Month End Act1 Completion Payment Command for provider: {command.Ukprn}");
                await context.SendLocal(command).ConfigureAwait(false);
            }

            logger.LogInfo($"Successfully processed Period End Stopped Event for {message.CollectionPeriod.Period:00}-{message.CollectionPeriod.AcademicYear}, job: {message.JobId}");
        }
 internal Task Act() => sut.StoreCollectionPeriod(new PeriodEndStoppedEvent {
     CollectionPeriod = new CollectionPeriod {
         AcademicYear = academicYear, Period = period
     }, EventTime = completionDate
 });