You can create consumer, and then when it stops retrieving data, you can call consumer.close(). Or, if you want to conduct a survey again in the future, just call consumer.pause()and call .resumelater.
- . ,
data = consumer.poll()
if (!data.next()) {
consumer.close()
}
, poll ConsumerRecord<K,V> Iterable.