Package org.springframework.kafka.event
Class NonResponsiveConsumerEvent
java.lang.Object
java.util.EventObject
org.springframework.context.ApplicationEvent
org.springframework.kafka.event.KafkaEvent
org.springframework.kafka.event.NonResponsiveConsumerEvent
- All Implemented Interfaces:
Serializable
An event that is emitted when a consumer is not responding to the poll; with early
versions of the kafka-clients, this was a possible indication that the broker is down.
- Since:
- 1.3.1
- Author:
- Gary Russell
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
ConstructorDescriptionNonResponsiveConsumerEvent
(Object source, Object container, long timeSinceLastPoll, String id, Collection<org.apache.kafka.common.TopicPartition> topicPartitions, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer) Construct an instance with the provided properties. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.kafka.clients.consumer.Consumer<?,
?> Retrieve the consumer.The id of the listener (if@KafkaListener
) or the container bean name.long
How long since the last poll.Collection<org.apache.kafka.common.TopicPartition>
The TopicPartitions the container is listening to.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
-
NonResponsiveConsumerEvent
public NonResponsiveConsumerEvent(Object source, Object container, long timeSinceLastPoll, String id, Collection<org.apache.kafka.common.TopicPartition> topicPartitions, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer) Construct an instance with the provided properties.- Parameters:
source
- the container instance that generated the event.container
- the container or the parent container if the container is a child.timeSinceLastPoll
- the time since the last poll.id
- the container id.topicPartitions
- the topic partitions.consumer
- the consumer.- Since:
- 2.2.1
-
-
Method Details
-
getTimeSinceLastPoll
public long getTimeSinceLastPoll()How long since the last poll.- Returns:
- the time in milliseconds.
-
getTopicPartitions
The TopicPartitions the container is listening to.- Returns:
- the TopicPartition list.
-
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
-