'How to set the start and end offsets in KafkaConsumer?(kotlin or java)

I want to set offsets between startOffset and endOffset. topic has offsets from 0~10. And I want to get topic messages from 4~8 offsets.

how to set this?

(using kafka consumer api, java or kotlin)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source