Ejemplo n.º 1
0
 public static IServiceCollection AddUpdatesPollerService(
     this IServiceCollection services,
     PollerConfig config)
 {
     return(services
            .AddSingleton(config)
            .AddHostedService <UpdatesPollerService>());
 }
Ejemplo n.º 2
0
 public UpdatesPollerService(
     PollerConfig config,
     IUpdatesPublisher updatesPublisher,
     IUpdatesProvider updatesProvider,
     IUserLatestUpdateTimesRepository userLatestUpdateTimesRepository,
     ISentUpdatesRepository sentUpdatesRepository,
     VideoExtractor videoExtractor,
     ILogger <UpdatesPollerService> logger)
 {
     _config           = config;
     _updatesPublisher = updatesPublisher;
     _updatesProvider  = updatesProvider;
     _userLatestUpdateTimesRepository = userLatestUpdateTimesRepository;
     _sentUpdatesRepository           = sentUpdatesRepository;
     _videoExtractor = videoExtractor;
     _logger         = logger;
 }
Ejemplo n.º 3
0
        public static IServiceCollection AddUpdatesProducer <TProvider>(
            this IServiceCollection services,
            MongoDbConfig mongoDbConfig,
            RabbitMqConfig rabbitMqConfig,
            UpdatesProviderBaseConfig updatesProviderBaseConfig,
            PollerConfig pollerConfig,
            VideoExtractorConfig videoExtractorConfig) where TProvider : class, IUpdatesProvider
        {
            services = mongoDbConfig != null
                ? services.AddUpdatesProducerMongoRepositories(mongoDbConfig)
                : services.AddUpdatesProducerMockRepositories();

            return(services
                   .AddRabbitMqUpdatesPublisher(rabbitMqConfig)
                   .AddVideoExtractor(videoExtractorConfig)
                   .AddUpdatesProvider <TProvider>(updatesProviderBaseConfig)
                   .AddUpdatesPollerService(pollerConfig));
        }