Interface EventHandlingComponent
- All Superinterfaces:
DescribableComponent,EventHandler,MessageHandler,ReplayStatusChangedHandler,ResetHandler
- All Known Implementing Classes:
AnnotatedEventHandlingComponent,DeadLetteringEventHandlingComponent,DelegatingEventHandlingComponent,InterceptingEventHandlingComponent,ReplayBlockingEventHandlingComponent,SequenceCachingEventHandlingComponent,SequenceOverridingEventHandlingComponent,SequencingEventHandlingComponent,SimpleEventHandlingComponent,TracingEventHandlingComponent
EventHandlers belonging to a single component.
As such, it allows registration of EventHandlers through the EventHandlerRegistry. Besides handling
and registration, it specifies which events it supports.
Additionally, this component supports reset operations through the ResetHandler. The supportsReset()
method indicates whether the component can participate in replay operations.
- Since:
- 3.0.0
- Author:
- Rene de Waele, Steven van Beelen
-
Method Summary
Modifier and TypeMethodDescriptiondefault MessageStream.Empty<Message> handle(ReplayStatusChanged statusChange, ProcessingContext context) Handles the givenReplayStatusChangedmessage, allowing for tasks to be performed when thereplay startsandends.sequenceIdentifierFor(EventMessage event, ProcessingContext context) Returns the sequence identifier for the givenevent.All supportedevents, referenced through aQualifiedName.default booleansupports(QualifiedName eventName) Checks whether the giveneventNameis supported by this component.default booleanIndicates whether this component supports reset operations.Methods inherited from interface org.axonframework.common.infra.DescribableComponent
describeToMethods inherited from interface org.axonframework.messaging.eventhandling.EventHandler
handleMethods inherited from interface org.axonframework.messaging.eventhandling.replay.ResetHandler
handle
-
Method Details
-
supportedEvents
Set<QualifiedName> supportedEvents()All supportedevents, referenced through aQualifiedName.- Returns:
- All supported
events, referenced through aQualifiedName.
-
supports
Checks whether the giveneventNameis supported by this component.- Parameters:
eventName- The name of the event to check for support.- Returns:
trueif the giveneventNameis supported,falseotherwise.
-
sequenceIdentifierFor
Returns the sequence identifier for the givenevent. When two events have the same sequence identifier (as defined by their equals method), they will be executed sequentially. Important: AllEventHandlersfor the sameQualifiedNamewithin a singleEventHandlingComponentmust return the same sequence identifier for a given event. Mixing different sequence identifiers within the scope of a singleEventHandlingComponentis not supported and may lead to undefined behavior.- Parameters:
event- The event for which to get the sequencing identifier.context- The processing context in which the event is being handled.- Returns:
- A sequence identifier for the given event.
-
supportsReset
default boolean supportsReset()Indicates whether this component supports reset operations.When
true, this component can participate in replay operations and itsResetHandler.handle(ResetContext, ProcessingContext)method will be called before replay begins.By default, reset is supported.
- Returns:
trueif this component supports reset operations,falseotherwise.
-
handle
default MessageStream.Empty<Message> handle(ReplayStatusChanged statusChange, ProcessingContext context) Description copied from interface:ReplayStatusChangedHandlerHandles the givenReplayStatusChangedmessage, allowing for tasks to be performed when thereplay startsandends.This method is invoked on the moment the
ReplayStatusis about to change as part of the event handlingProcessingContext. In doing so, this handler has two concrete moments when it is invoked:- When the
ReplayStatuschanges fromReplayStatus.REGULARtoReplayStatus.REPLAY, exactly before the first replayed event is processed - When the
ReplayStatuschanges fromReplayStatus.REPLAYtoReplayStatus.REGULAR, exactly after processing the final event of the replay
If this operation returns a
failed MessageStream, event handling that occurs within the givencontextis impacted. The failure will be passed to theErrorHandler, typically resulting in a rollback of the invoked event handling tasks.- Specified by:
handlein interfaceReplayStatusChangedHandler- Parameters:
statusChange- the replay status context message containing replay status informationcontext- the processing context for this operation- Returns:
- an empty message stream after handling completes successfully
- When the
-