public interface HandlerLifecycle
HandlerMethod
invocation.
If the target of the method implements HandlerLifecycle
, it is invoked alongside
handler method. For example:
class SignUpSubscriber extends AbstractEventSubscriber implements HandlerLifecycle { @Subscribe void on(UserSignedUp event) { // ... } @Override public void beforeInvoke(HandlerMethod, ?, ?, ?> method) { // ... } @Override public void afterInvoke(HandlerMethod, ?, ?, ?> method) { // ... } }
When a UserSignedUp
event is dispatched to the SignUpSubscriber
,
the invocation order goes as follows:
beforeInvoke([instance representing on(UserSignedUp) method])
.
on(UserSignedUp)
.
afterInvoke([instance representing on(UserSignedUp) method])
.
Modifier and Type | Method and Description |
---|---|
void |
afterInvoke(HandlerMethod<?,?,?,?> method)
A callback for a handler method invocation end.
|
void |
beforeInvoke(HandlerMethod<?,?,?,?> method)
A callback for a handler method invocation start.
|
void beforeInvoke(HandlerMethod<?,?,?,?> method)
The handler method is invoked immediately after this method.
void afterInvoke(HandlerMethod<?,?,?,?> method)
This method is invoked immediately after the handler method, even if it has thrown an exception.