Example #1
0
        public FileSystemConsumerImplementation(string directoryPath, ILoggerFactory loggerFactory, IEnumerable <string> topics, string group, IConsumerDispatcher consumerDispatcher, IPositionManager positionManager)
        {
            if (topics == null)
            {
                throw new ArgumentNullException(nameof(topics));
            }
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }
            _directoryPath      = directoryPath;
            _consumerDispatcher = consumerDispatcher ?? throw new ArgumentNullException(nameof(consumerDispatcher));
            _positionManager    = positionManager ?? throw new ArgumentNullException(nameof(positionManager));

            _logger = loggerFactory.GetLogger(typeof(FileSystemConsumerImplementation));

            _workers = topics
                       .Select(topic => new Thread(() => PumpTopic(topic))
            {
                Name = $"Kafkaesque worker for topic '{topic}'"
            })
                       .ToList();
        }
Example #2
0
 public FileSystemProducerImplementation(string directoryPath, ILoggerFactory loggerFactory)
 {
     _directoryPath = directoryPath;
     _logger        = loggerFactory.GetLogger(typeof(FileSystemProducerImplementation));
     _logger.Info("Kafkaesque producer initialized with directory {directoryPath}", directoryPath);
 }