public NotificationsService( IQueueClientFactory queueClientFactory, ISettings settings) { if (queueClientFactory == null) { throw new ArgumentNullException(nameof(queueClientFactory)); } if (settings == null) { throw new ArgumentNullException(nameof(settings)); } _emailNotificationQueueClient = queueClientFactory.CreateClient(settings.ServiceBusSettings.EmailNotificationQueue); _pushNotificationQueueClient = queueClientFactory.CreateClient(settings.ServiceBusSettings.PushNotificationQueue); _smsNotificationQueueClient = queueClientFactory.CreateClient(settings.ServiceBusSettings.SmsNotificationQueue); }
private List <IQueueProcessor> FindConfigsToAdd(List <ConfigurationEntry> configurations, List <IQueueProcessor> processors, IQueueClientFactory queueClientFactory, IMessageProcessorFactory messageProcessorFactory, IQueueProcessorFactory queueProcessorFactory) { var toAdd = new List <IQueueProcessor>(); foreach (var config in configurations) { if (!config.Active) { continue; } var found = false; foreach (var processor in processors) { found = ((config.Alias == processor.Configuration.Alias) && (config.AccessKey == processor.Configuration.AccessKey) && (config.AwsGatewayToken == processor.Configuration.AwsGatewayToken) && (config.AuthToken == processor.Configuration.AuthToken) && (config.QueueUrl == processor.Configuration.QueueUrl) && (config.RedriveUrl == processor.Configuration.RedriveUrl) && (config.Region == processor.Configuration.Region) && (config.SecretKey == processor.Configuration.SecretKey)); if (found) { break; } } if (!found) { Logger.Debug($"Creating new queueprocessor for queue [{config.QueueUrl}], url [{config.RedriveUrl}], alias [{config.Alias}]"); var queueClient = queueClientFactory.CreateClient(config); queueClient.Init(); var queueProcessor = queueProcessorFactory.CreateQueueProcessor(); queueProcessor.Init(queueClient, messageProcessorFactory, config); toAdd.Add(queueProcessor); } } return(toAdd); }
public DataUpdateService( IStocksRepository stocksRepository, IAlertDefinitionsRepository alertDefinitionsRepository, IStockDataWebClient stockDataWebClient, IQueueClientFactory queueClientFactory, ISettings settings) { _stocksRepository = stocksRepository ?? throw new ArgumentNullException(nameof(stocksRepository)); _alertDefinitionsRepository = alertDefinitionsRepository ?? throw new ArgumentNullException(nameof(alertDefinitionsRepository)); _stockDataWebClient = stockDataWebClient ?? throw new ArgumentNullException(nameof(stockDataWebClient)); if (settings == null) { throw new ArgumentNullException(nameof(settings)); } if (queueClientFactory == null) { throw new ArgumentNullException(nameof(queueClientFactory)); } _alertProcessingQueueClient = queueClientFactory.CreateClient(settings.ServiceBusSettings.AlertProcessingQueue); }