private Task Handle(IProviderEvent notification) { if (notification == null) { throw new ArgumentNullException(nameof(notification), "Should not be null"); } _logger.LogInformation("Handling {eventType} for ukprn: {ukprn}", notification.GetType().Name, notification.Ukprn); return(_dashboardService.ReBuildDashboardAsync(notification.Ukprn)); }
public async Task Handle(VacancyTransferredEvent notification, CancellationToken cancellationToken) { if (notification == null) { throw new ArgumentNullException(nameof(notification), "Should not be null"); } var vacancy = await _vacancyRepository.GetVacancyAsync(notification.VacancyReference); _logger.LogInformation("Handling {eventType} for ukprn: {ukprn} and vacancyReference: {vacancyReference}", notification.GetType().Name, vacancy.TrainingProvider.Ukprn.Value, notification.VacancyReference); await _dashboardService.ReBuildDashboardAsync(vacancy.TrainingProvider.Ukprn.GetValueOrDefault()); }
public async Task ReGenerateSingleProviderDashboard([QueueTrigger(QueueNames.GenerateSingleProviderDashboardQueueName, Connection = "QueueStorage")] string message, TextWriter log) { const string individualJobName = "SingleProviderDashboardGeneratorJob"; if (_jobsConfig.DisabledJobs.Contains(individualJobName)) { _logger.LogDebug($"{individualJobName} is disabled, skipping ..."); return; } try { var data = JsonConvert.DeserializeObject <ProviderDashboardCreateMessage>(message); _logger.LogInformation($"Start {JobName} For Provider Account: {data.Ukprn}"); await _projectionService.ReBuildDashboardAsync(data.Ukprn); _logger.LogInformation($"Finished {JobName} For Provider Account: {data.Ukprn}"); } catch (JsonException ex) { _logger.LogError(ex, "Unable to deserialise event: {eventBody}", message); throw; } catch (Exception ex) { _logger.LogError(ex, $"Unable to run {JobName}."); throw; } }