You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @gAmUssA, thank you for the issue. Since I was working on refactoring the configuration classes KafkaConsumerConfigs, KafkaProducerConfigs (which now implement MutableMap), I've added Kotlin extensions to easily load config from properties file.
Some examples showing how to load config file :
// Example 1 -> KafkaConsumerConfigs can be directly used to create a new KafkaConsumerKafkaConsumer<String, String>(KafkaConsumerConfigs()
.load("/tmp/config.properties")
.keyDeserializer(StringDeserializer::class.java.name)
.valueDeserializer(StringDeserializer::class.java.name)
).use {
// do something useful
}
// Example 2 -> using convenient function// i.e : one of : loadClientConfigs, loadConsumerConfig, loadProducerConfigsval configs:KafkaProducerConfigs= loadProducerConfigs("/tmp/config.properties")
// Example 3 -> also work with KafkaClients DSL
kafka(loadClientConfigs("/tmp/config.properties")) {
client {
clientId("demo-client")
}
}
ref. https://github.com/confluentinc/examples/blob/5.5.1-post/clients/cloud/kotlin/src/main/kotlin/io/confluent/examples/clients/cloud/util/Utils.kt
The text was updated successfully, but these errors were encountered: