Producer automatic topic creation is disabled when there are multiple topics #3058
Open
Description
Description
When using the producer with: allowAutoTopicCreation = true
, the func tryRefreshMetadata
on file client.go
is behaving strangely:
allowAutoTopicCreation := client.conf.Metadata.AllowAutoTopicCreation
if len(topics) > 0 {
DebugLogger.Printf("client/metadata fetching metadata for %v from broker %s\n", topics, broker.addr)
} else {
allowAutoTopicCreation = false
DebugLogger.Printf("client/metadata fetching metadata for all topics from broker %s\n", broker.addr)
}
req := NewMetadataRequest(client.conf.Version, topics)
req.AllowAutoTopicCreation = allowAutoTopicCreation
This behavior reproduces for both sync and async producers. So if you are asynchronously sending messages to different topics, they won't respect the allowAutoTopicCreation
configuration.
I don't know if this is a technical limitation or not, but this behavior is totally hidden from the developer.
Versions
github.com/IBM/sarama v1.44.0
Metadata
Assignees
Labels
No labels