예제 #1
0
        public KafkaProducerTests()
        {
            var services = new ServiceCollection()
                           .AddSingleton <EndpointsConfiguratorsInvoker>()
                           .AddSingleton(typeof(ISilverbackIntegrationLogger <>), typeof(IntegrationLoggerSubstitute <>));

            _broker = new KafkaBroker(services.BuildServiceProvider());
        }
예제 #2
0
        public KafkaBrokerTests()
        {
            var serviceProvider = ServiceProviderHelper.GetServiceProvider(
                services => services
                .AddSilverback()
                .WithConnectionToMessageBroker(options => options.AddKafka()));

            _broker = serviceProvider.GetRequiredService <KafkaBroker>();
        }
예제 #3
0
        private static void Connect()
        {
            var messageKeyProvider = new MessageKeyProvider(new[] { new DefaultPropertiesMessageKeyProvider() });

            _broker = new KafkaBroker(messageKeyProvider, GetLoggerFactory(), new MessageLogger(messageKeyProvider));
            _broker.Connect();

            _producer = _broker.GetProducer(new KafkaProducerEndpoint("Topic1")
            {
                Configuration = new KafkaProducerConfig
                {
                    BootstrapServers = "PLAINTEXT://kafka:9092"
                }
            });
        }