Class CheckpointTriggerParameterResolverFactory
- All Implemented Interfaces:
ParameterResolverFactory
ParameterResolverFactory constructing a ParameterResolver resolving the CheckpointTrigger
for the segment currently being handled.
This is the additive convenience that lets a self-checkpointing event handler declare a CheckpointTrigger
parameter and call requestCheckpoint directly, instead of retaining the trigger handed to it through
Checkpointing.onSegmentClaimed(org.axonframework.messaging.eventhandling.processing.streaming.segmenting.Segment, CheckpointTrigger).
Expects the CheckpointTrigger to reside in the ProcessingContext under
CheckpointTrigger.RESOURCE_KEY. A
streaming event
processor places it there per batch whenever it has
at least one Checkpointing component. The trigger is segment-scoped: it is shared by every
handler in that processor on the claimed segment, not restricted to the checkpointing component(s). A requested
checkpoint therefore applies to all the processor's components on that segment.
Important: a CheckpointTrigger is not available to every handler. The resolver always
matches (so the handler is never silently skipped), but if no
trigger is present when the parameter is resolved it fails the handler invocation with a descriptive
IllegalStateException rather than passing null. A CheckpointTrigger parameter is therefore
only usable on a handler running in a streaming event processor that has at least one Checkpointing
component; declaring it on a handler that may run in a subscribing or otherwise non-checkpointing processor, or in a
processor with no checkpointing component at all, will raise that exception at runtime.
Internal API. This factory is marked Internal: it is part of the self-checkpointing support, which is
currently intended primarily for internal and advanced use and whose shape may change in a minor or patch release.
- Since:
- 5.3.0
- Author:
- Allard Buijze
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable ParameterResolver<CheckpointTrigger> createInstance(Executable executable, Parameter[] parameters, int parameterIndex) If available, creates aParameterResolverinstance that can provide a parameter of typeparameterTypefor a given message.
-
Constructor Details
-
CheckpointTriggerParameterResolverFactory
public CheckpointTriggerParameterResolverFactory()
-
-
Method Details
-
createInstance
public @Nullable ParameterResolver<CheckpointTrigger> createInstance(Executable executable, Parameter[] parameters, int parameterIndex) Description copied from interface:ParameterResolverFactoryIf available, creates aParameterResolverinstance that can provide a parameter of typeparameterTypefor a given message.If the
ParameterResolverFactorycannot provide a suitableParameterResolver, returnsnull.- Specified by:
createInstancein interfaceParameterResolverFactory- Parameters:
executable- The executable (constructor or method) to inspect.parameters- The parameters on the executable to inspect.parameterIndex- The index of the parameter to return aParameterResolverfor.- Returns:
- A suitable
ParameterResolver, ornullif none is found.
-