Difference between Spring's ConsumerSeekAware.onPartitionsAssigned and ConsumerAwareRebalanceListener.onPartitionsAssigned

Viewed 145

Spring has two interfaces: ConsumerSeekAware and ConsumerAwareRebalanceListener that provide a similarly named method: onPartitionsAssigned().

I assume the org.springframework.kafka.listener.ConsumerAwareRebalanceListener.onPartitionsAssigned() behaves like the Kafka org.apache.kafka.clients.consumer.ConsumerRebalanceListener.onPartitionsAssigned(), getting called every time a partition re-assignment occurs, including at consumer start up.

How does the org.springframework.kafka.listener.ConsumerSeekAware.onPartitionsAssigned() work ? When does it get called ? On every partition re-assignment or only when the consumer starts listening ?

If I need to force a consumer to start reading from the beginning is it OK to seek to offset 0 on all assigned partitions in the ConsumerSeekAware.onPartitionsAssigned() or will that force it to the beginning after every partition re-assignment (e.g during re-balancing) ?

0 Answers
Related