Class SegmentParameterResolverFactory
java.lang.Object
org.axonframework.messaging.eventhandling.processing.streaming.segmenting.annotation.SegmentParameterResolverFactory
- All Implemented Interfaces:
ParameterResolverFactory
Implementation of a
ParameterResolverFactory that resolves the Segment from the
ProcessingContext whenever it's available.
A streaming event processor places the Segment currently being handled in the context under
Segment.RESOURCE_KEY, so a handler method may declare a Segment parameter to learn which segment it is
processing -- for example to key segment-scoped state or address a segment-specific collaborator.
The resolver always matches (so a handler declaring a
Segment parameter is never silently skipped) and resolves to null when no Segment is
present (a processor that is not aware of segments, such as a subscribing processor). A null Segment
is harmless to receive, so this resolver does not fail when one is absent.
- Since:
- 5.3.0
- Author:
- Allard Buijze
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable ParameterResolver<Segment> createInstance(Executable executable, Parameter[] parameters, int parameterIndex) If available, creates aParameterResolverinstance that can provide a parameter of typeparameterTypefor a given message.
-
Constructor Details
-
SegmentParameterResolverFactory
public SegmentParameterResolverFactory()
-
-
Method Details
-
createInstance
public @Nullable ParameterResolver<Segment> 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.
-