Class ListenerContainerPartitionIdleEvent

  • All Implemented Interfaces:
    java.io.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:
    Serialized Form
    • Field Summary

      • Fields inherited from class java.util.EventObject

        source
    • Constructor Summary

      Constructors 
      Constructor Description
      ListenerContainerPartitionIdleEvent​(java.lang.Object source, java.lang.Object container, long idleTime, java.lang.String id, org.apache.kafka.common.TopicPartition topicPartition, org.apache.kafka.clients.consumer.Consumer<?,​?> consumer, boolean paused)
      Construct an instance with the provided arguments.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.apache.kafka.clients.consumer.Consumer<?,​?> getConsumer()
      Retrieve the consumer.
      long getIdleTime()
      How long the partition has been idle.
      java.lang.String getListenerId()
      The id of the listener (if @KafkaListener) or the container bean name.
      org.apache.kafka.common.TopicPartition getTopicPartition()
      The idle TopicPartition.
      boolean isPaused()
      Return true if the consumer was paused at the time the idle event was published.
      java.lang.String toString()  
      • Methods inherited from class org.springframework.context.ApplicationEvent

        getTimestamp
      • Methods inherited from class java.util.EventObject

        getSource
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ListenerContainerPartitionIdleEvent

        public ListenerContainerPartitionIdleEvent​(java.lang.Object source,
                                                   java.lang.Object container,
                                                   long idleTime,
                                                   java.lang.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 Detail

      • 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 java.lang.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 java.lang.String toString()
        Overrides:
        toString in class java.util.EventObject