public class AnnotationEventListenerAdapter extends Object implements Subscribable, EventListenerProxy, ReplayAware
EventHandler
annotated methods into an EventListener
.EventListener
Constructor and Description |
---|
AnnotationEventListenerAdapter(Object annotatedEventListener)
Wraps the given
annotatedEventListener , allowing it to be subscribed to an Event Bus. |
AnnotationEventListenerAdapter(Object annotatedEventListener,
EventBus eventBus)
Deprecated.
Use
AnnotationEventListenerAdapter(Object) and subscribe the listener to the event bus
using EventBus.subscribe(org.axonframework.eventhandling.EventListener) |
AnnotationEventListenerAdapter(Object annotatedEventListener,
ParameterResolverFactory parameterResolverFactory)
Wraps the given
annotatedEventListener , allowing it to be subscribed to an Event Bus. |
Modifier and Type | Method and Description |
---|---|
void |
afterReplay()
Invoked when a replay has finished.
|
void |
beforeReplay()
Invoked when a replay is started.
|
Class<?> |
getTargetType()
Returns the instance type that this proxy delegates all event handling to.
|
void |
handle(EventMessage event)
Process the given event.
|
void |
onReplayFailed(Throwable cause)
Invoked when a replay has failed due to an exception.
|
void |
subscribe()
Deprecated.
Use
EventBus.subscribe(org.axonframework.eventhandling.EventListener) and
pass this adapter instance to subscribe it. |
static AnnotationEventListenerAdapter |
subscribe(Object annotatedEventListener,
EventBus eventBus)
Subscribe the given
annotatedEventListener to the given eventBus . |
void |
unsubscribe()
Deprecated.
Use
EventBus.unsubscribe(org.axonframework.eventhandling.EventListener) and
pass this adapter instance to unsubscribe it. |
public AnnotationEventListenerAdapter(Object annotatedEventListener)
annotatedEventListener
, allowing it to be subscribed to an Event Bus.annotatedEventListener
- the annotated event listenerpublic AnnotationEventListenerAdapter(Object annotatedEventListener, ParameterResolverFactory parameterResolverFactory)
annotatedEventListener
, allowing it to be subscribed to an Event Bus. The given
parameterResolverFactory
is used to resolve parameter values for handler methods.annotatedEventListener
- the annotated event listenerparameterResolverFactory
- the strategy for resolving handler method parameter values@Deprecated public AnnotationEventListenerAdapter(Object annotatedEventListener, EventBus eventBus)
AnnotationEventListenerAdapter(Object)
and subscribe the listener to the event bus
using EventBus.subscribe(org.axonframework.eventhandling.EventListener)
annotatedEventListener
. When the
adapter
subscribes, it will subscribe to the given event bus.annotatedEventListener
- the event listenereventBus
- the event bus to register the event listener topublic static AnnotationEventListenerAdapter subscribe(Object annotatedEventListener, EventBus eventBus)
annotatedEventListener
to the given eventBus
.annotatedEventListener
- The annotated event listenereventBus
- The event bus to subscribe topublic void handle(EventMessage event)
handle
in interface EventListener
event
- the event to handle@PreDestroy @Deprecated public void unsubscribe()
EventBus.unsubscribe(org.axonframework.eventhandling.EventListener)
and
pass this adapter instance to unsubscribe it.unsubscribe
in interface Subscribable
@PostConstruct @Deprecated public void subscribe()
EventBus.subscribe(org.axonframework.eventhandling.EventListener)
and
pass this adapter instance to subscribe it.subscribe
in interface Subscribable
public Class<?> getTargetType()
EventListenerProxy
getTargetType
in interface EventListenerProxy
public void beforeReplay()
ReplayAware
beforeReplay
in interface ReplayAware
public void afterReplay()
ReplayAware
afterReplay
in interface ReplayAware
public void onReplayFailed(Throwable cause)
ReplayAware
onReplayFailed
in interface ReplayAware
cause
- The exception that stopped the replay;Copyright © 2010-2014. All Rights Reserved.