Example #1
0
        internal ConsumerConfiguration Build()
        {
            if (!_namingConventions.Any())
            {
                _namingConventions.Add(item: NamingConvention.Default);
            }

            FillConfiguration();
            ValidateConfiguration();

            if (_consumerScopeFactory == null)
            {
                _consumerScopeFactory = new KafkaBasedConsumerScopeFactory(
                    configuration: _configurations,
                    topics: _messageHandlerRegistry.GetAllSubscribedTopics(),
                    incomingMessageFactory: _incomingMessageFactory
                    );
            }

            return(new ConsumerConfiguration(
                       configuration: _configurations,
                       messageHandlerRegistry: _messageHandlerRegistry,
                       unitOfWorkFactory: _unitOfWorkFactory,
                       consumerScopeFactory: _consumerScopeFactory
                       ));
        }
Example #2
0
 public ConsumerConfiguration(IDictionary <string, string> configuration, MessageHandlerRegistry messageHandlerRegistry,
                              IHandlerUnitOfWorkFactory unitOfWorkFactory, IConsumerScopeFactory consumerScopeFactory)
 {
     KafkaConfiguration     = configuration;
     MessageHandlerRegistry = messageHandlerRegistry;
     UnitOfWorkFactory      = unitOfWorkFactory;
     ConsumerScopeFactory   = consumerScopeFactory;
 }
Example #3
0
 public Consumer(
     MessageHandlerRegistry messageHandlerRegistry,
     IHandlerUnitOfWorkFactory unitOfWorkFactory,
     IConsumerScopeFactory consumerScopeFactory,
     IUnconfiguredMessageHandlingStrategy fallbackHandler,
     bool isAutoCommitEnabled = false)
 {
     _localMessageDispatcher =
         new LocalMessageDispatcher(
             messageHandlerRegistry,
             unitOfWorkFactory,
             fallbackHandler);
     _consumerScopeFactory =
         consumerScopeFactory
         ?? throw new ArgumentNullException(nameof(consumerScopeFactory));
     _isAutoCommitEnabled = isAutoCommitEnabled;
 }
Example #4
0
 internal void WithConsumerScopeFactory(IConsumerScopeFactory consumerScopeFactory)
 {
     _builder.WithConsumerScopeFactory(consumerScopeFactory);
 }
Example #5
0
 internal ConsumerConfigurationBuilder WithConsumerScopeFactory(IConsumerScopeFactory consumerScopeFactory)
 {
     _consumerScopeFactory = consumerScopeFactory;
     return(this);
 }