Package org.springframework.kafka.event
Class KafkaEvent
java.lang.Object
java.util.EventObject
org.springframework.context.ApplicationEvent
org.springframework.kafka.event.KafkaEvent
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ConsumerFailedToStartEvent
,ConsumerPartitionPausedEvent
,ConsumerPartitionResumedEvent
,ConsumerPausedEvent
,ConsumerResumedEvent
,ConsumerRetryAuthEvent
,ConsumerRetryAuthSuccessfulEvent
,ConsumerStartedEvent
,ConsumerStartingEvent
,ConsumerStoppedEvent
,ConsumerStoppingEvent
,ContainerStoppedEvent
,ListenerContainerIdleEvent
,ListenerContainerNoLongerIdleEvent
,ListenerContainerPartitionIdleEvent
,ListenerContainerPartitionNoLongerIdleEvent
,NonResponsiveConsumerEvent
Base class for events.
- Author:
- Gary Russell
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T> T
getContainer
(Class<T> type) Get the container for which the event was published, which will be the parent container if the source that emitted the event is a child container, or the source itself otherwise.<T> T
Get the container (source) that published the event.Methods inherited from class org.springframework.context.ApplicationEvent
getTimestamp
Methods inherited from class java.util.EventObject
getSource, toString
-
Constructor Details
-
KafkaEvent
-
-
Method Details
-
getContainer
Get the container for which the event was published, which will be the parent container if the source that emitted the event is a child container, or the source itself otherwise. The type is required here to avoid a dependency tangle between the event and listener packages.- Type Parameters:
T
- the type.- Parameters:
type
- the container type (e.g.MessageListenerContainer.class
).- Returns:
- the container.
- Since:
- 2.2.1
- See Also:
-
getSource
Get the container (source) that published the event. This is provided as an alternative toEventObject.getSource()
to avoid the need to cast in user code. The type is required here to avoid a dependency tangle between the event and listener packages.- Type Parameters:
T
- the type.- Parameters:
type
- the container type (e.g.MessageListenerContainer.class
).- Returns:
- the container.
- Since:
- 2.2.1
- See Also:
-