Kafka connect has its own set of configurations to programmatically create topics, without relying upon the broker to auto-create new topics.
Is there something similar for the producer (java) API?
Kafka connect has its own set of configurations to programmatically create topics, without relying upon the broker to auto-create new topics.
Is there something similar for the producer (java) API?
Producer? No, apart from auto-create capability - when actually producer requests a metadata of a topic that does not exist, and that caused the backend to create a topic with default configuration (if enabled). Similar with consumers (fun fact: they can be configured not to create topics even if auto-creation is enabled).
If you want to have finer control, you'd need Kafka Admin instance.
By default, producer API also will auto create topics, when a topic doesn't exist, and a producer trying to publish a message for the first time. But it is not recommended, as it may be created with default configuration values set at broker side.
When auto.create.topics.enable is set to true in Kafka configuration, the following are the circumstances under which a Kafka broker automatically creates a topic.
Hope this helps.