Enabling auto creation of topics allow you to write to a topic that does not exists. The only thing that you can define in your KafkaProducer is the name of the topic.
All configurations for that topic will be set according to your default settings for topics, also called Server Default Property.
In the documentation on the Topic Configuration you will find the corresponding configuration names, for example the Server Default Property for topic configcleanup.policy
is broker config log.cleanup.policy
.
In case you need full control of checking for the existence of a topic and create it with specific configuration programatically, you can make use of the AdminClient.