Package org.springframework.kafka.event
Class ListenerContainerPartitionNoLongerIdleEvent
java.lang.Object
java.util.EventObject
org.springframework.context.ApplicationEvent
org.springframework.kafka.event.KafkaEvent
org.springframework.kafka.event.ListenerContainerPartitionNoLongerIdleEvent
- All Implemented Interfaces:
Serializable
An event that is emitted when a partition is no longer idle if configured to publish
idle events.
- Since:
- 2.6.2
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
ConstructorDescriptionListenerContainerPartitionNoLongerIdleEvent
(Object source, Object container, long idleTime, String id, org.apache.kafka.common.TopicPartition topicPartition, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer) Construct an instance with the provided arguments. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.kafka.clients.consumer.Consumer<?,
?> Retrieve the consumer.long
How long the partition was idle.The id of the listener (if@KafkaListener
) or the container bean name.org.apache.kafka.common.TopicPartition
The idle TopicPartition.toString()
Methods inherited from class org.springframework.kafka.event.KafkaEvent
getContainer, getSource
Methods inherited from class org.springframework.context.ApplicationEvent
getTimestamp
Methods inherited from class java.util.EventObject
getSource
-
Constructor Details
-
ListenerContainerPartitionNoLongerIdleEvent
public ListenerContainerPartitionNoLongerIdleEvent(Object source, Object container, long idleTime, String id, org.apache.kafka.common.TopicPartition topicPartition, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer) 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
- how long the container was idle.id
- the container id.topicPartition
- the idle topic/partition.consumer
- the consumer.
-
-
Method Details
-
getTopicPartition
public org.apache.kafka.common.TopicPartition getTopicPartition()The idle TopicPartition.- Returns:
- the TopicPartition.
-
getIdleTime
public long getIdleTime()How long the partition was idle.- Returns:
- the time in milliseconds.
-
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.
-
toString
- Overrides:
toString
in classEventObject
-