コード例 #1
0
        private Task RequestProviderCommunicationAsync(long ukprn)
        {
            var communicationRequest = new CommunicationRequest(
                CommunicationConstants.RequestType.ProviderBlockedProviderNotification,
                CommunicationConstants.ParticipantResolverNames.ProviderParticipantsResolverName,
                CommunicationConstants.ServiceName);

            communicationRequest.AddEntity(CommunicationConstants.EntityTypes.Provider, ukprn);
            communicationRequest.AddEntity(CommunicationConstants.EntityTypes.ApprenticeshipServiceConfig, null);

            return(_communicationQueueService.AddMessageAsync(communicationRequest));
        }
        public Task DailyApplicationsSubmittedCreateAggregateRequestAsync([TimerTrigger(Schedules.EightAmDaily)] TimerInfo timerInfo, TextWriter log)
        {
            const int eightAmHour = 8;

            _logger.LogInformation($"Timer trigger {this.GetType().Name} fired");

            var to   = _timeProvider.Today.AddHours(eightAmHour);
            var from = to.AddDays(-1);

            var message = new AggregateCommunicationRequest(Guid.NewGuid(), CommunicationConstants.RequestType.ApplicationSubmitted, DeliveryFrequency.Daily, _timeProvider.Now, from, to);

            return(_queue.AddMessageAsync(message));
        }
コード例 #3
0
        public async Task HandleAsync(string eventPayload)
        {
            var @event = DeserializeEvent <VacancyReviewedEvent>(eventPayload);

            try
            {
                _logger.LogInformation($"Processing {nameof(VacancyReviewedEvent)} for vacancy: {{VacancyId}}", @event.VacancyId);

                var communicationRequest = GetReviewedVacancyCommunicationRequest(@event.VacancyReference, @event.Ukprn, @event.EmployerAccountId);
                await _queue.AddMessageAsync(communicationRequest);

                _logger.LogInformation($"Finished Processing {nameof(VacancyReviewedEvent)} for vacancy: {{VacancyId}}", @event.VacancyId);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Unable to process {eventBody}", @event);
                throw;
            }
        }
コード例 #4
0
        private async Task CreateClosedVacancyProjection(Guid vacancyId)
        {
            var vacancyTask   = _repository.GetVacancyAsync(vacancyId);
            var programmeTask = _referenceDataReader.GetReferenceData <ApprenticeshipProgrammes>();

            await Task.WhenAll(vacancyTask, programmeTask);

            var vacancy   = vacancyTask.Result;
            var programme = programmeTask.Result.Data.Single(p => p.Id == vacancy.ProgrammeId);

            await _queryStore.UpdateClosedVacancyAsync(vacancy.ToVacancyProjectionBase <ClosedVacancy>(programme, () => QueryViewType.ClosedVacancy.GetIdValue(vacancy.VacancyReference.ToString()), _timeProvider));

            if (vacancy.ClosureReason == ClosureReason.WithdrawnByQa)
            {
                _logger.LogInformation($"Queuing up withdrawn notification message for vacancy {vacancy.VacancyReference}");
                var communicationRequest = GetVacancyWithdrawnByQaCommunicationRequest(vacancy.VacancyReference.Value);
                await _communicationQueueService.AddMessageAsync(communicationRequest);
            }
        }
        public async Task HandleAsync(string eventPayload)
        {
            var @event = DeserializeEvent <ApplicationSubmittedEvent>(eventPayload);
            var communicationRequest = GetApplicationSubmittedCommunicationRequest(@event.Application.VacancyReference);

            try
            {
                _logger.LogInformation($"Processing {nameof(ApplicationSubmittedEvent)} for vacancy: {{VacancyReference}} and candidate: {{CandidateId}}", @event.Application.VacancyReference, @event.Application.CandidateId);

                await _client.CreateApplicationReviewAsync(@event.Application);

                await _communicationQueueService.AddMessageAsync(communicationRequest);

                _logger.LogInformation($"Finished Processing {nameof(ApplicationSubmittedEvent)} for vacancy: {{VacancyReference}} and candidate: {{CandidateId}}", @event.Application.VacancyReference, @event.Application.CandidateId);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Unable to process {eventBody}", @event);
                throw;
            }
        }
        private Task SendNotificationToEmployerAsync(long ukprn, string employerAccountId)
        {
            var communicationRequest = CommunicationRequestFactory.GetProviderBlockedEmployerNotificationForLiveVacanciesRequest(ukprn, employerAccountId);

            return(_communicationQueueService.AddMessageAsync(communicationRequest));
        }