|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.axonframework.eventhandling.annotation.AnnotationEventListenerAdapter
public class AnnotationEventListenerAdapter
Adapter that turns any bean with EventHandler annotated methods into an EventListener.
AsynchronousEventListener annotation, it is also configured to handle events
asynchronously. In that case, event processing is handed over to the given Executor.
EventListener,
AsynchronousEventHandlerWrapper| Constructor Summary | |
|---|---|
AnnotationEventListenerAdapter(Object annotatedEventListener,
EventBus eventBus)
Initialize the AnnotationEventListenerAdapter for the given annotatedEventListener. |
|
AnnotationEventListenerAdapter(Object annotatedEventListener,
Executor executor,
EventBus eventBus)
Initialize the AnnotationEventListenerAdapter for the given annotatedEventListener. |
|
| Method Summary | |
|---|---|
void |
afterTransaction(TransactionStatus transactionStatus)
Invoked by the EventProcessingScheduler after a series of events is processed. |
void |
beforeTransaction(TransactionStatus transactionStatus)
Invoked by the EventProcessingScheduler before processing a series of events. |
Object |
getTarget()
Returns the instance that this proxy delegates all event handling to |
void |
handle(Event event)
Process the given event. |
void |
subscribe()
Subscribe the EventListener with the configured EventBus. |
void |
unsubscribe()
Unsubscribe the EventListener with the configured EventBus. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AnnotationEventListenerAdapter(Object annotatedEventListener,
EventBus eventBus)
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 to
public AnnotationEventListenerAdapter(Object annotatedEventListener,
Executor executor,
EventBus eventBus)
annotatedEventListener. If the
annotatedEventListener is asynchronous (has the AsynchronousEventListener) annotation) then
the given executor is used to execute event processing.
annotatedEventListener - the event listenerexecutor - The executor to use when wiring an Asynchronous Event Listener.eventBus - the event bus to register the event listener to| Method Detail |
|---|
public void handle(Event event)
handle in interface EventListenerevent - the event to handlepublic void beforeTransaction(TransactionStatus transactionStatus)
TransactionStatus
may be used to set the maximum batch size for the current transaction.
beforeTransaction in interface TransactionManagertransactionStatus - The current status of the transactionTransactionManager.afterTransaction(TransactionStatus),
TransactionStatuspublic void afterTransaction(TransactionStatus transactionStatus)
TransactionStatus may be used to indicate whether the scheduler should yield to other event processing
schedulers or not.
This method is always called once for each invocation to TransactionManager.beforeTransaction(TransactionStatus), even if
no events were processed at all.
Note that this method is called when a transactional batch was handled successfully, as well as when an error
occurred. Use the TransactionStatus object to find information about transaction status and (when failed)
the cause of the failure.
afterTransaction in interface TransactionManagertransactionStatus - The current status of the transactionTransactionManager.beforeTransaction(TransactionStatus),
TransactionStatus@PreDestroy public void unsubscribe()
unsubscribe in interface Subscribable@PostConstruct public void subscribe()
subscribe in interface Subscribablepublic Object getTarget()
EventListenerProxy
getTarget in interface EventListenerProxy
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||