Пример #1
0
 public ClusterConfiguration(
     KafkaConfiguration kafka,
     IEnumerable <string> brokers)
 {
     this.Kafka   = kafka;
     this.Brokers = brokers.ToList();
 }
Пример #2
0
 public ClusterConfiguration(
     KafkaConfiguration kafka,
     IEnumerable <string> brokers,
     Func <SecurityInformation> securityInformationHandler)
 {
     this.securityInformationHandler = securityInformationHandler;
     this.Kafka   = kafka;
     this.Brokers = brokers.ToList();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="KafkaFlowConfigurator"/> class.
        /// </summary>
        /// <param name="dependencyConfigurator">Dependency injection configurator</param>
        /// <param name="kafka">A handler to setup the configuration</param>
        public KafkaFlowConfigurator(
            IDependencyConfigurator dependencyConfigurator,
            Action <IKafkaConfigurationBuilder> kafka)
        {
            var builder = new KafkaConfigurationBuilder(dependencyConfigurator);

            kafka(builder);

            this.configuration = builder.Build();
        }
        public ClusterConfiguration Build(KafkaConfiguration kafkaConfiguration)
        {
            var configuration = new ClusterConfiguration(
                kafkaConfiguration,
                this.brokers.ToList());

            configuration.AddProducers(this.producers.Select(x => x.Build(configuration)));
            configuration.AddConsumers(this.consumers.Select(x => x.Build(configuration)));

            return(configuration);
        }
        public KafkaConfiguration Build()
        {
            var configuration = new KafkaConfiguration();

            configuration.AddClusters(this.clusters.Select(x => x.Build(configuration)));

            this.dependencyConfigurator
            .AddSingleton(typeof(ILogHandler), this.logHandler)
            .AddSingleton <IConsumerAccessor>(ConsumerManager.Instance)
            .AddSingleton <IConsumerManager>(ConsumerManager.Instance);

            return(configuration);
        }
Пример #6
0
        public ClusterConfiguration Build(KafkaConfiguration kafkaConfiguration)
        {
            var configuration = new ClusterConfiguration(
                kafkaConfiguration,
                this.brokers.ToList());

            configuration.AddProducers(this.producers.Select(x => x.Build(configuration)));
            configuration.AddConsumers(this.consumers.Select(x => x.Build(configuration)));

            this.DependencyConfigurator.AddSingleton <IProducerAccessor>(
                resolver => new ProducerAccessor(
                    configuration.Producers.Select(producer => new MessageProducer(resolver, producer))));

            return(configuration);
        }
        public ClusterConfiguration Build(KafkaConfiguration kafkaConfiguration)
        {
            var configuration = new ClusterConfiguration(
                kafkaConfiguration,
                this.brokers.ToList());

            configuration.AddProducers(this.producers.Select(x => x.Build(configuration)));
            configuration.AddConsumers(this.consumers.Select(x => x.Build(configuration)));

            foreach (var producer in configuration.Producers)
            {
                this.dependencyConfigurator.AddSingleton <IMessageProducer>(resolver => new MessageProducer(resolver, producer));
            }

            return(configuration);
        }
        public KafkaConfiguration Build()
        {
            var configuration = new KafkaConfiguration();

            configuration.AddClusters(this.clusters.Select(x => x.Build(configuration)));

            var consumerManager = new ConsumerManager();

            this.dependencyConfigurator
            .AddSingleton(typeof(ILogHandler), this.logHandler)
            .AddSingleton <IConsumerAccessor>(consumerManager)
            .AddSingleton <IConsumerManager>(consumerManager)
            .AddSingleton <IProducerAccessor>(resolver => new ProducerAccessor(resolver.ResolveAll <IMessageProducer>()));

            return(configuration);
        }