Package org.springframework.kafka.event
Class ConsumerStoppingEvent
java.lang.Object
java.util.EventObject
org.springframework.context.ApplicationEvent
org.springframework.kafka.event.KafkaEvent
org.springframework.kafka.event.ConsumerStoppingEvent
- All Implemented Interfaces:
Serializable
An event published when a consumer is stopped. While it is best practice to use
stateless listeners, you can consume this event to clean up any thread-based resources
(remove ThreadLocals, destroy thread-scoped beans etc), as long as the context event
multicaster is not modified to use an async task executor.
- Since:
- 2.2
- Author:
- Gary Russell
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
ConstructorDescriptionConsumerStoppingEvent
(Object source, Object container, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer, Collection<org.apache.kafka.common.TopicPartition> partitions) Construct an instance with the provided source, consumer and partitions. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.kafka.clients.consumer.Consumer<?,
?> Collection<org.apache.kafka.common.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
-
ConsumerStoppingEvent
public ConsumerStoppingEvent(Object source, Object container, org.apache.kafka.clients.consumer.Consumer<?, ?> consumer, Collection<org.apache.kafka.common.TopicPartition> partitions) Construct an instance with the provided source, consumer and partitions.- Parameters:
source
- the container instance that generated the event.container
- the container or the parent container if the container is a child.consumer
- the consumer.partitions
- the partitions.- Since:
- 2.2.1
-
-
Method Details
-
getConsumer
public org.apache.kafka.clients.consumer.Consumer<?,?> getConsumer() -
getPartitions
-
toString
- Overrides:
toString
in classEventObject
-