Hello! I am new to Kafka and am trying to get my first producer client (see the code below) to work.
var config = new ProducerConfig()
{
BootstrapServers = "localhost:9092",
ClientId = Dns.GetHostName(),
};
var producer = new ProducerBuilder<Null, string>(config).Build();
producer.Produce("activity", new Message<Null, string> {Value = "message"});
The problem I am running into is that it takes a long time (~85 seconds) for the first produced message to show up on the consumer side; the subsequent messages after the first one show up almost immediately.
My dev and test environment is Windows 10 + .NET 4.8 with the following software versions:
kafka_2.13-2.7.0
apache-zookeeper-3.6.2-bin
Confluent.Kafka 1.5.3
Kafka, ZooKeeper and the test application all run on the same Windows 10 machine.
I was using kafka-console-consumer.bat as the consumer. When I used kafka-console-producer.bat as the producer, the text that I entered on the producer side gets picked up immediately by the consumer:
kafka-console-consumer.bat --topic activity --bootstrap-server localhost:9092
kafka-console-producer.bat --topic activity --bootstrap-server localhost:9092
So my question is what could be causing the different behavior between the .NET producer and kafka-console-producer.bat? What parameters on ProducerConfig can I tune to speed up the first message?