This the part that Matt is talking about - ``` pri...
# tornadofx
a
This the part that Matt is talking about -
Copy code
private fun consumeMessages(consumer: KafkaConsumer<String, String>, messageHistory: MessageHistoryController) {
        val messageList = mutableListOf<String>()
        consumer.subscribe(listOf("messages"))
        runAsync {
            while (true) {
                val records = consumer.poll(Duration.ofSeconds(1))
                if (records.count() == 0) continue
                records.forEach {
                    messageList.add(it.value())
                }
            }
        } ui {
            messageList.forEach {
                messageHistory.values.add(it)
            }
        }
    }