Ejemplo n.º 1
0
 public FileIndexWatcherService(
     IIndexWatcher watcher,
     IOptionsMonitor <PublisherOptions> optionsMonitor,
     ILogger <FileIndexWatcherService> logger)
 {
     _watcher     = watcher;
     _options     = optionsMonitor.CurrentValue;
     _reloadToken = optionsMonitor.OnChange(ReloadOptions);
     _logger      = logger;
 }
 public KafkaMessagePublisher(
     IOptions <KafkaPublisherOptions <TOutput> > options,
     CloudEventFormatter cloudEventFormatter,
     IOptions <PublisherOptions> publisherOptions)
 {
     _cloudEventFormatter = cloudEventFormatter;
     _options             = options.Value ?? throw new ArgumentNullException(nameof(options));
     _publisherOptions    = publisherOptions.Value ?? throw new ArgumentNullException(nameof(publisherOptions));
     _producer            = new ProducerBuilder <string?, byte[]>(_options).Build();
 }
Ejemplo n.º 3
0
        public static IServiceCollection AddRabbitPublisher <T>(this IServiceCollection services, Action <PublisherOptions <T> > setup)
        {
            var options = new PublisherOptions <T>();

            setup.Invoke(options);

            services.AddSingleton <IRabbitPublisher <T>, RabbitPublisher <T> >();
            services.AddSingleton(options);

            return(services);
        }
 public NATSMessagePublisher(
     IOptions <NATSBaseOptions> options,
     INATSClientFactory natsClientFactory,
     CloudEventFormatter cloudEventFormatter,
     IOptions <PublisherOptions> publisherOptions)
 {
     _options             = options.Value;
     _client              = natsClientFactory.From(_options);
     _cloudEventFormatter = cloudEventFormatter;
     _publisherOptions    = publisherOptions.Value;
 }
Ejemplo n.º 5
0
 public Worker(
     IIndexerClient indexerClient,
     IIndexWatcher watcher,
     IOptionsMonitor <PublisherOptions> optionsMonitor,
     ILogger <Worker> logger)
 {
     _indexerClient = indexerClient;
     _watcher       = watcher;
     _options       = optionsMonitor.CurrentValue;
     _reloadToken   = optionsMonitor.OnChange(ReloadOptions);
     _logger        = logger;
 }
Ejemplo n.º 6
0
 public RabbitMQMessagePublisher(
     IRabbitMQConnectionFactory <TOutput> connectionFactory,
     IOptions <RabbitMQPublisherOptions <TOutput> > config,
     IOptions <PublisherOptions> publisherOptions,
     CloudEventFormatter cloudEventFormatter
     )
 {
     ConnectionFactory    = connectionFactory;
     _options             = config.Value;
     _publisherOptions    = publisherOptions.Value;
     _cloudEventFormatter = cloudEventFormatter;
 }
Ejemplo n.º 7
0
 private void ReloadOptions(PublisherOptions options)
 {
     _logger.LogInformation("Reloading options from configuration");
     _options = options;
 }