private static void Connect() { _producer = _broker.GetProducer(new KafkaProducerEndpoint("Topic1") { Configuration = new KafkaProducerConfig { BootstrapServers = "PLAINTEXT://localhost:9092" } }); _broker.Connect(); Console.CancelKeyPress += (_, e) => { _broker.Disconnect(); }; }
private static void Connect() { _consumer = _broker.GetConsumer(new KafkaConsumerEndpoint("Topic1") { Configuration = new KafkaConsumerConfig { BootstrapServers = "PLAINTEXT://localhost:9092", GroupId = "silverback-consumer", AutoOffsetReset = Confluent.Kafka.AutoOffsetReset.Earliest }, Serializer = new JsonMessageSerializer <TestMessage>() }); _consumer.Received += OnMessageReceived; _broker.Connect(); Console.CancelKeyPress += (_, e) => { _broker.Disconnect(); _activity.Stop(); }; }
private static void Disconnect() { _broker.Disconnect(); }