Class ListenerContainerPartitionIdleEvent

All Implemented Interfaces:
Serializable

public class ListenerContainerPartitionIdleEvent extends KafkaEvent
An event that is emitted when a container partition is idle if the container is configured to do so.
Since:
2.7
Author:
Tomaz Fernandes
See Also:
  • Constructor Details

    • ListenerContainerPartitionIdleEvent

      public ListenerContainerPartitionIdleEvent(Object source, Object container, long idleTime, String id, org.apache.kafka.common.TopicPartition topicPartition, org.apache.kafka.clients.consumer.Consumer<?,?> consumer, boolean paused)
      Construct an instance with the provided arguments.
      Parameters:
      source - the container instance that generated the event.
      container - the container or the parent container if the container is a child.
      idleTime - the idle time.
      id - the container id.
      topicPartition - the topic/partition.
      consumer - the consumer.
      paused - true if the consumer partition is paused.
      Since:
      2.7
  • Method Details

    • getIdleTime

      public long getIdleTime()
      How long the partition has been idle.
      Returns:
      the time in milliseconds.
    • getTopicPartition

      public org.apache.kafka.common.TopicPartition getTopicPartition()
      The idle TopicPartition.
      Returns:
      the TopicPartition.
    • getListenerId

      public String getListenerId()
      The id of the listener (if @KafkaListener) or the container bean name.
      Returns:
      the id.
    • getConsumer

      public org.apache.kafka.clients.consumer.Consumer<?,?> getConsumer()
      Retrieve the consumer. Only populated if the listener is consumer-aware. Allows the listener to resume a paused consumer.
      Returns:
      the consumer.
      Since:
      2.0
    • isPaused

      public boolean isPaused()
      Return true if the consumer was paused at the time the idle event was published.
      Returns:
      paused.
      Since:
      2.1.5
    • toString

      public String toString()
      Overrides:
      toString in class EventObject