confluent-kafka-dotnet icon indicating copy to clipboard operation
confluent-kafka-dotnet copied to clipboard

Kafka Producer throws “Broker: Unknown topic or partition” exception.

Open chinmayiinjam opened this issue 2 years ago • 2 comments

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

chinmayiinjam avatar Jun 16 '23 00:06 chinmayiinjam

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.

RFPAlves avatar Jun 17 '23 02:06 RFPAlves

@chinmayiinjam Is this still an issue even after verifying what @RFPAlves suggested above? If so, please provide debug logs.

anchitj avatar Feb 20 '24 12:02 anchitj