public abstract class KafkaEvent
extends org.springframework.context.ApplicationEvent
Constructor and Description |
---|
KafkaEvent(java.lang.Object source)
Deprecated.
|
KafkaEvent(java.lang.Object source,
java.lang.Object container) |
Modifier and Type | Method and Description |
---|---|
<T> T |
getContainer(java.lang.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 |
getSource(java.lang.Class<T> type)
Get the container (source) that published the event.
|
@Deprecated public KafkaEvent(java.lang.Object source)
public KafkaEvent(java.lang.Object source, java.lang.Object container)
public <T> T getContainer(java.lang.Class<T> type)
T
- the type.type
- the container type (e.g. MessageListenerContainer.class
).getSource(Class)
public <T> T getSource(java.lang.Class<T> type)
EventObject.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.T
- the type.type
- the container type (e.g. MessageListenerContainer.class
).getContainer(Class)
,
EventObject.getSource()