Package org.axonframework.eventhandling
Interface EventHandlerInvoker
- All Known Implementing Classes:
AbstractSagaManager,AnnotatedSagaManager,DeadLetteringEventHandlerInvoker,MultiEventHandlerInvoker,SimpleEventHandlerInvoker
public interface EventHandlerInvoker
Interface for an event message handler that defers handling to one or more other handlers.
- Since:
- 3.0
- Author:
- Rene de Waele
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanHandle(EventMessage<?> eventMessage, Segment segment) Check whether or not this invoker has handlers that can handle the giveneventMessagefor a givensegment.default booleancanHandleType(Class<?> payloadType) Check whether or not this invoker has handlers that can handle the givenpayloadType.voidhandle(EventMessage<?> message, Segment segment) Handle the givenmessagefor the givensegment.default voidPerforms any activities that are required to reset the state managed by handlers assigned to this invoker.default <R> voidperformReset(R resetContext) Performs any activities that are required to reset the state managed by handlers assigned to this invoker.default voidsegmentReleased(Segment segment) This is a way for an event processor to communicate that a segment which was being processed is released.default booleanIndicates whether the handlers managed by this invoker support a reset.
-
Method Details
-
canHandle
Check whether or not this invoker has handlers that can handle the giveneventMessagefor a givensegment.- Parameters:
eventMessage- The message to be processedsegment- The segment for which the event handler should be invoked- Returns:
trueif the invoker has one or more handlers that can handle the given message,falseotherwise
-
canHandleType
Check whether or not this invoker has handlers that can handle the givenpayloadType.- Parameters:
payloadType- The payloadType of the message to be processed- Returns:
trueif the invoker has one or more handlers that can handle the given message,falseotherwise
-
handle
Handle the givenmessagefor the givensegment.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.- Parameters:
message- The message to handlesegment- The segment for which to handle the message- Throws:
Exception- when an exception occurs while handling the message
-
supportsReset
default boolean supportsReset()Indicates whether the handlers managed by this invoker support a reset.- Returns:
trueif a reset is supported, otherwisefalse
-
performReset
default void performReset()Performs any activities that are required to reset the state managed by handlers assigned to this invoker. -
performReset
default <R> void performReset(@Nullable R resetContext) Performs any activities that are required to reset the state managed by handlers assigned to this invoker.- Type Parameters:
R- the type of the providedresetContext- Parameters:
resetContext- aRused to support the reset operation
-
segmentReleased
This is a way for an event processor to communicate that a segment which was being processed is released. This might be needed or required to free resources, are clean up state which is related to theSegment.- Parameters:
segment- the segment which was released.
-