public interface EventHandlerInvoker
Modifier and Type | Method and Description |
---|---|
boolean |
canHandle(EventMessage<?> eventMessage,
Segment segment)
Check whether or not this invoker has handlers that can handle the given
eventMessage for a given segment . |
default boolean |
canHandleType(Class<?> payloadType)
Check whether or not this invoker has handlers that can handle the given
payloadType . |
void |
handle(EventMessage<?> message,
Segment segment)
Handle the given
message for the given segment . |
default void |
performReset()
Performs any activities that are required to reset the state managed by handlers assigned to this invoker.
|
default <R> void |
performReset(R resetContext)
Performs any activities that are required to reset the state managed by handlers assigned to this invoker.
|
default boolean |
supportsReset()
Indicates whether the handlers managed by this invoker support a reset.
|
boolean canHandle(@Nonnull EventMessage<?> eventMessage, @Nonnull Segment segment)
eventMessage
for a given segment
.eventMessage
- The message to be processedsegment
- The segment for which the event handler should be invokedtrue
if the invoker has one or more handlers that can handle the given message, false
otherwisedefault boolean canHandleType(@Nonnull Class<?> payloadType)
payloadType
.payloadType
- The payloadType of the message to be processedtrue
if the invoker has one or more handlers that can handle the given message, false
otherwisevoid handle(@Nonnull EventMessage<?> message, @Nonnull Segment segment) throws Exception
message
for the given segment
.
Callers are recommended to invoke canHandle(EventMessage, Segment)
prior to invocation, but aren't
required to do so. Implementations must ensure to take the given segment into account when processing messages.
message
- The message to handlesegment
- The segment for which to handle the messageException
- when an exception occurs while handling the messagedefault boolean supportsReset()
true
if a reset is supported, otherwise false
default void performReset()
default <R> void performReset(@Nullable R resetContext)
R
- the type of the provided resetContext
resetContext
- a R
used to support the reset operationCopyright © 2010–2023. All rights reserved.