consumer.consume(Consumer { record -> println("Got key "
+ record.key()).toString() +
" val " +
record.value().toString() })
fun consume(recordConsumer: Consumer<ConsumerRecord<String, String>>) {
thread {
while (true) {
val records = consumer.poll(Duration.ofSeconds(1))
records.forEach{record -> recordConsumer.accept(record)}
}
}
}