Hello. I'd like to know how to implement a multi-threaded consumer, which retrieve message(s) from a topic per thread.
I read the Kafka Consumer 0.9.0.1 API document from https://kafka.apache.org/090/javadoc/index.html?org/apache/kafka/clients/consumer/KafkaConsumer.html, and I copied and pasted the example source code from here. And I tried to manage threads via ThreadPoolTaskExecutor, but exception occurrd while executing multi-thread. The API document mentioned that multi-threaded access should be properly synchronized, but I think the example code seems missing something for that. My understanding of Kafka is probably bad so that I guess I may be using the API and functions of kafka wrongly... Could you give me a good sample code how to develop the multi-threaded consumer or any advice? Do I need to use commitSync() method somewhere to solve the problem? Thanks in advance! Best regards bgkim