Class ReplayBlockingEventHandlingComponent<E extends EventHandlingComponent & ResetHandlerRegistry<?>>
java.lang.Object
org.axonframework.messaging.eventhandling.DelegatingEventHandlingComponent
org.axonframework.messaging.eventhandling.replay.ReplayBlockingEventHandlingComponent<E>
- Type Parameters:
E- the delegateEventHandlingComponentandResetHandlerRegistryimplementation
- All Implemented Interfaces:
DescribableComponent,MessageHandler,EventHandler,EventHandlingComponent,ReplayStatusChangedHandler,ResetHandler,ResetHandlerRegistry<ReplayBlockingEventHandlingComponent<E>>
public class ReplayBlockingEventHandlingComponent<E extends EventHandlingComponent & ResetHandlerRegistry<?>>
extends DelegatingEventHandlingComponent
implements ResetHandlerRegistry<ReplayBlockingEventHandlingComponent<E>>
An
EventHandlingComponent that blocks all event handling during replay.
This component wraps another EventHandlingComponent and prevents any events from being processed when the
current TrackingToken indicates a replay is in progress (i.e., when the token is a ReplayToken).
The supportsReset() method returns true only if at least one ResetHandler has been
registered through subscribe(ResetHandler).
- Since:
- 5.1.0
- Author:
- Mateusz Nowak
- See Also:
-
Field Summary
Fields inherited from class org.axonframework.messaging.eventhandling.DelegatingEventHandlingComponent
delegate -
Constructor Summary
ConstructorsConstructorDescriptionReplayBlockingEventHandlingComponent(E delegate) Constructs aReplayBlockingEventHandlingComponentthat wraps the givendelegate. -
Method Summary
Modifier and TypeMethodDescriptionhandle(EventMessage event, ProcessingContext context) Handles the giveneventunless a replay is in progress.subscribe(ResetHandler resetHandler) Subscribes aResetHandlerand tracks that at least one reset handler has been registered.booleanReturns whether this component supports reset operations.Methods inherited from class org.axonframework.messaging.eventhandling.DelegatingEventHandlingComponent
describeTo, handle, handle, sequenceIdentifierFor, supportedEvents, supports
-
Constructor Details
-
ReplayBlockingEventHandlingComponent
Constructs aReplayBlockingEventHandlingComponentthat wraps the givendelegate.- Parameters:
delegate- TheEventHandlingComponentto delegate calls to.
-
-
Method Details
-
handle
Handles the giveneventunless a replay is in progress.If the
TrackingTokenin thecontextindicates a replay (i.e., is aReplayToken), this method returns an emptyMessageStreamwithout delegating to the wrapped component.- Specified by:
handlein interfaceEventHandler- Overrides:
handlein classDelegatingEventHandlingComponent- Parameters:
event- The event message to handle.context- The processing context containing the tracking token.- Returns:
- An empty
MessageStreamif replaying, otherwise the result from the delegate.
-
subscribe
Subscribes aResetHandlerand tracks that at least one reset handler has been registered.This tracking is used by
supportsReset()to determine if the component supports reset operations.- Specified by:
subscribein interfaceResetHandlerRegistry<E extends EventHandlingComponent & ResetHandlerRegistry<?>>- Parameters:
resetHandler- The reset handler to subscribe.- Returns:
- A
ResetHandlerRegistryfor managing the subscription.
-
supportsReset
public boolean supportsReset()Returns whether this component supports reset operations.This implementation returns
trueonly if at least oneResetHandlerhas been registered throughsubscribe(ResetHandler).- Specified by:
supportsResetin interfaceEventHandlingComponent- Overrides:
supportsResetin classDelegatingEventHandlingComponent- Returns:
trueif a reset handler has been registered,falseotherwise.
-