public AuthWorker( IMessageProcessorFactory processorFactory, IQueueManager queueManager, IMessageLogger logger) { _processorFactory = processorFactory; _logger = logger; queueManager.AddMessageConsumer(AuthSettings.AuthInputQueue, OnMessageConsume); }
public PhotoWorker( IMessageProcessorFactory processorFactory, IQueueManager queueManager, IMessageLogger logger) { _processorFactory = processorFactory; _logger = logger; queueManager.AddMessageConsumer(PhotoSettings.PhotoInputQueue, OnMessageConsume); }
public void Init(IQueueClient queueClient, IMessageProcessorFactory messageProcessorFactory, ConfigurationEntry configuration) { Configuration = configuration; _queueClient = queueClient; _messageProcessorFactory = messageProcessorFactory; }
public void Setup() { listOfCars = new List <Car>() { new Car(), new Car() }; messageProcessorFactory = new MessageProcessorFactory(); target = new QueueManager(messageProcessorFactory); target.Init(listOfCars, 20); }
/// <summary> /// Creates instance of <see cref="MessageProcessor"/> /// </summary> /// <param name="logger">Provides logging</param> /// <param name="telegramBotClient">A client interface to use the Telegram Bot API</param> /// <param name="messageProcessorFactory">Provides the necessary message processor</param> /// <param name="adminIdsProvider">Provides the list of admins</param> /// <param name="messageTypeIdentifier">Identifies the type of message</param> public MessageProcessor(ILogger logger, ITelegramBotClient telegramBotClient, IMessageProcessorFactory messageProcessorFactory, IAdminIdsProvider adminIdsProvider, IMessageTypeIdentifier messageTypeIdentifier) { _adminIdsProvider = adminIdsProvider; _messageTypeIdentifier = messageTypeIdentifier; _adminMessageProcessor = messageProcessorFactory.GetMessageProcessor <AdminMessageProcessor>(); _userMessageProcessor = messageProcessorFactory.GetMessageProcessor <UserMessageProcessor>(); _adminIds = adminIdsProvider.AdminIds; adminIdsProvider.AdminListUpdatedAction += UpdateAdminIds; }
public void Setup() { listOfCars = new List<Car>() { new Car(), new Car() }; messageProcessorFactory = new MessageProcessorFactory(); target = new QueueManager(messageProcessorFactory); target.Init(listOfCars, 20); }
public Orchestrator(IConfigurationReader configurationReader, IQueueClientFactory queueClientFactory, IMessageProcessorFactory messageProcessorFactory, IQueueProcessorFactory queueProcessorFactory, IConfigurationChangeManager configurationChangeManager) { IsProcessing = false; _configurationReader = configurationReader; _queueClientFactory = queueClientFactory; _messageProcessorFactory = messageProcessorFactory; _queueProcessorFactory = queueProcessorFactory; _configurationChangeManager = configurationChangeManager; }
public QueueManager(IMessageProcessorFactory messageProcessorFactory) { _messageProcessorFactory = messageProcessorFactory; _queueLookup = new Dictionary<Car, MessageQueue>(); _groups = new Dictionary<int, ManagedGroup>(); UnhandledThreadException += i => { var group = _groups[i]; group.ExceptionCount++; RebuildManagedGroup(group); }; }
public QueueManager(IMessageProcessorFactory messageProcessorFactory) { _messageProcessorFactory = messageProcessorFactory; _queueLookup = new Dictionary <Car, MessageQueue>(); _groups = new Dictionary <int, ManagedGroup>(); UnhandledThreadException += i => { var group = _groups[i]; group.ExceptionCount++; RebuildManagedGroup(group); }; }
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 void ReadChanges(IConfigurationReader configurationReader, List <IQueueProcessor> processors, IQueueClientFactory queueClientFactory, IMessageProcessorFactory messageProcessorFactory, IQueueProcessorFactory queueProcessorFactory) { var configurations = configurationReader.ReadConfiguration(); /* * First, create processors to add. */ var toAdd = FindConfigsToAdd(configurations, processors, queueClientFactory, messageProcessorFactory, queueProcessorFactory); /* * Second, find processors to remove. */ var toRemove = FindEntriesToRemove(configurations, processors); /* * Now remove those for removal and add the new ones. */ foreach (var processor in toRemove) { Logger.Info($"Stopping queueprocessor for queue [{processor.Configuration.QueueUrl}], url [{processor.Configuration.RedriveUrl}], alias [{processor.Configuration.Alias}]"); processor.Stop(); processors.Remove(processor); } foreach (var processor in toAdd) { Logger.Info($"Starting new queueprocessor for queue [{processor.Configuration.QueueUrl}], url [{processor.Configuration.RedriveUrl}], alias [{processor.Configuration.Alias}]"); processor.Start(); processors.Add(processor); } }
public ServerMesssageService(IFileWatcherFactory fileWatcherFactory, IMessageProcessorFactory messageProcessorFactory) : base(fileWatcherFactory, messageProcessorFactory) { }
/// <summary> /// Initializes a new instance of the <see cref="MessageProcessorInvoker"/> class. /// </summary> /// <param name="processorStorage">Message processors storage.</param> /// <param name="processorFactory">Message processors factory.</param> public MessageProcessorInvoker(IMessageProcessorStorage processorStorage, IMessageProcessorFactory processorFactory) { _processorStorage = processorStorage; _processorFactory = processorFactory; }
public ConnectionManager(IMessageProcessorFactory messageProcessorFactory) { _messageProcessorFactory = messageProcessorFactory; }
public Subscriber(IOptions <RabbitSettings> options, IMessageProcessorFactory factory, Serializer <string> serializer) { _options = options.Value; _factory = factory ?? throw new ArgumentNullException(nameof(factory)); _serializer = serializer ?? throw new ArgumentNullException(nameof(serializer)); }
public LoggerWorker(IMessageProcessorFactory processorFactory, IQueueManager queueManager, ILogger <LoggerWorker> logger) { _processorFactory = processorFactory; _logger = logger; queueManager.AddMessageConsumer(LoggerSettings.LoggerInputQueue, OnMessageConsume); }
public BaseProcessorService(IFileWatcherFactory fileWatcherFactory, IMessageProcessorFactory messageProcessorFactory) { this.messageProcessorFactory = messageProcessorFactory; this.fileWatcherFactory = fileWatcherFactory; }
public QueueWatcherFactory(IFileWatcherFactory fileWatcherFactory, IMessageProcessorFactory messageProcessorFactory) { this.fileWatcherFactory = fileWatcherFactory; this.messageProcessorFactory = messageProcessorFactory; }