Package io.micronaut.configuration.kafka
Interface ConsumerSeekAware
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Interface for
KafkaListener
instances to implement if they wish to perform
seek operations
when the set of partitions assigned to the
Consumer
changes.
This callback interface is based on ConsumerRebalanceListener
and it provides a
KafkaSeeker
object that can perform KafkaSeekOperation
instances immediately.
- Since:
- 4.1
- Author:
- Guillermo Calvo
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
onPartitionsAssigned
(@NonNull Collection<TopicPartition> partitions, @NonNull KafkaSeeker seeker) A callback method the user can implement to provide handling of customized offsets on completion of a successful partition re-assignment.default void
onPartitionsLost
(@NonNull Collection<TopicPartition> partitions) default void
onPartitionsRevoked
(@NonNull Collection<TopicPartition> partitions)
-
Method Details
-
onPartitionsAssigned
void onPartitionsAssigned(@NonNull @NonNull Collection<TopicPartition> partitions, @NonNull @NonNull KafkaSeeker seeker) A callback method the user can implement to provide handling of customized offsets on completion of a successful partition re-assignment.This method will be called after the partition re-assignment completes and before the consumer starts fetching data, and only as the result of a
poll(long)
call. Under normal conditions,onPartitionsRevoked(Collection)
will be executed beforeonPartitionsAssigned(Collection, KafkaSeeker)
.The provided
KafkaSeeker
object can performseek operations
on the underlying consumer.- Parameters:
partitions
- The list of partitions that are now assigned to the consumerseeker
- The object that can performseek operations
- See Also:
-
onPartitionsRevoked
- Parameters:
partitions
- The list of partitions that were assigned to the consumer and now need to be revoked (may not include all currently assigned partitions, i.e. there may still be some partitions left)- See Also:
-
onPartitionsLost
- Parameters:
partitions
- The list of partitions that are now assigned to the consumer (previously owned partitions will NOT be included, i.e. this list will only include newly added partitions)- See Also:
-