Ejemplo n.º 1
0
 /// <summary>
 /// Constructs a new instance of broker egress Kafka driver.
 /// </summary>
 /// <param name="driverConfiguration">
 /// The driver configuration.
 /// </param>
 /// <param name="producerRegistry">
 /// The producer registry.
 /// </param>
 public BrokerEgressKafkaDriver(
     [NotNull] BrokerEgressKafkaDriverConfiguration driverConfiguration,
     [NotNull] IProducerRegistry producerRegistry)
 {
     _driverConfiguration = driverConfiguration ?? throw new ArgumentNullException(nameof(driverConfiguration));
     _producerRegistry    = producerRegistry ?? throw new ArgumentNullException(nameof(producerRegistry));
 }
        /// <summary>
        /// Sets Kafka driver as broker egress driver.
        /// </summary>
        /// <param name="brokerEgress">
        /// The broker egress.
        /// </param>
        /// <param name="configurator">
        /// The broker egress Kafka driver configurator.
        /// </param>
        /// <returns>
        /// This broker egress configurator.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// This broker egress configurator is not specified.
        /// </exception>
        public static BrokerEgressConfigurator WithKafkaDriver(
            this BrokerEgressConfigurator brokerEgress,
            [NotNull] Action <BrokerEgressKafkaDriverConfigurator> configurator)
        {
            if (configurator == null)
            {
                throw new ArgumentNullException(nameof(configurator));
            }

            var configuration = new BrokerEgressKafkaDriverConfiguration();

            configurator(new BrokerEgressKafkaDriverConfigurator(configuration));
            IBrokerEgressDriverConfigurator driverConfigurator = brokerEgress;

            driverConfigurator.SetDriver(new BrokerEgressKafkaDriver(configuration, new DefaultProducerRegistry()), configuration);
            return(brokerEgress);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Constructs a new instance of configurator.
 /// </summary>
 /// <param name="configuration">
 /// The egress Kafka driver configuration to configure with this configurator.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// The egress Kafka driver configuration is not specified.
 /// </exception>
 public BrokerEgressKafkaDriverConfigurator([NotNull] BrokerEgressKafkaDriverConfiguration configuration)
 {
     _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
 }