コード例 #1
0
        public static BrokerEgressConfigurator WithTestDriver(this BrokerEgressConfigurator egress)
        {
            IBrokerEgressDriverConfigurator driverConfigurator = egress;

            driverConfigurator.SetDriver(Mock.Of <IBrokerEgressDriver>(), Mock.Of <IMessageRouterConfigurationPart>());
            return(egress);
        }
コード例 #2
0
        public static BrokerEgressConfigurator WithSpecificDriver(this BrokerEgressConfigurator egress, IBrokerEgressDriver driver)
        {
            IBrokerEgressDriverConfigurator driverConfigurator = egress;

            driverConfigurator.SetDriver(driver, Mock.Of <IMessageRouterConfigurationPart>());
            return(egress);
        }
コード例 #3
0
        /// <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);
        }