confluent-kafka-dotnet
confluent-kafka-dotnet copied to clipboard
Kafka Producer throws “Broker: Unknown topic or partition” exception.
Description
Kafka Producer Throws the below exception when sending messages:
One or more errors occurred. (Broker: Unknown topic or partition)
---> Confluent.Kafka.ProduceException2[System.String,System.String]: Broker: Unknown topic or partition at Confluent.Kafka.Producer2.ProduceAsync(TopicPartition topicPartition, Message`2 message, CancellationToken cancellationToken)
How to reproduce
configured the Kafka Producer with necessary details. AllowAutoCreateTopics was set to true. created topic on the broker. below is code implemented: await producer.Produceasync("topicname", new Message<string, string> { Key = "key", Value = "value" ) producer.Flush(TimeSpan.FromSeconds(10));
Checklist
Please provide the following information: Not sure of all the configuration details. Confluent.Kafka nuget version. 2.1.1. console app in .net6
Your broker auto.create.topics.enable setting must be enabled.
auto.create.topics.enable=true
If you have access to broker, you can verify by typing:
kafka-configs --bootstrap-server <server:port> --entity-type brokers --describe --all | grep "auto.create.topics.enable"
If broker auto.create.topics.enable setting is disabled, AllowAutoCreateTopics in the ProducerBuilder has no effect.
@chinmayiinjam Is this still an issue even after verifying what @RFPAlves suggested above? If so, please provide debug logs.