Interface KafkaConsumerRebalanceListener


  • public interface KafkaConsumerRebalanceListener
    When implemented by a managed bean annotated with Named and configured against an inbound connector will be applied as a consumer re-balance listener to that inbound connector's consumer. To configure which listener you want to use, set the name in the inbound connector's consumer re-balance listener attribute, ex: mp.messaging.incoming.example.consumer-rebalance- listener.name=ExampleConsumerRebalanceListener @Named("ExampleConsumerRebalanceListener") Alternatively, name your listener (using the @Named annotation) to be the group id used by the connector, ex: mp.messaging.incoming.example.group.id=my-group @Named("my-group") Setting the consumer re-balance listener name takes precedence over using the group id. For more details:
    See Also:
    ConsumerRebalanceListener
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      io.smallrye.mutiny.Uni<Void> onPartitionsAssigned​(io.vertx.mutiny.kafka.client.consumer.KafkaConsumer<?,​?> consumer, Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
      Called when the consumer is assigned topic partitions This method might be called for each consumer available to the connector The consumer will be paused until the returned Uni indicates success.
      io.smallrye.mutiny.Uni<Void> onPartitionsRevoked​(io.vertx.mutiny.kafka.client.consumer.KafkaConsumer<?,​?> consumer, Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
      Called when the consumer is revoked topic partitions This method might be called for each consumer available to the connector
    • Method Detail

      • onPartitionsAssigned

        io.smallrye.mutiny.Uni<Void> onPartitionsAssigned​(io.vertx.mutiny.kafka.client.consumer.KafkaConsumer<?,​?> consumer,
                                                          Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
        Called when the consumer is assigned topic partitions This method might be called for each consumer available to the connector The consumer will be paused until the returned Uni indicates success. On failure will retry using an exponential back off until the consumer can be considered timed-out by Kafka, in which case will resume anyway triggering a new re-balance.
        Parameters:
        consumer - underlying consumer
        topicPartitions - set of assigned topic partitions
        Returns:
        A Uni indicating operations complete or failure
        See Also:
        KafkaConsumer.pause(), KafkaConsumer.resume()
      • onPartitionsRevoked

        io.smallrye.mutiny.Uni<Void> onPartitionsRevoked​(io.vertx.mutiny.kafka.client.consumer.KafkaConsumer<?,​?> consumer,
                                                         Set<io.vertx.kafka.client.common.TopicPartition> topicPartitions)
        Called when the consumer is revoked topic partitions This method might be called for each consumer available to the connector
        Parameters:
        consumer - underlying consumer
        topicPartitions - set of revoked topic partitions
        Returns:
        A Uni indicating operations complete or failure