Class MessageParameterResolver
java.lang.Object
io.fluxcapacitor.common.handling.TypedParameterResolver<Object>
io.fluxcapacitor.javaclient.tracking.handling.MessageParameterResolver
- All Implemented Interfaces:
ParameterResolver<Object>
Resolves handler method parameters of type
Message
.
This resolver is useful when a handler method needs access to the raw Message
object
associated with the invocation context.
Resolution is attempted via the message context itself (if it implements HasMessage
),
or from the current thread-local DeserializingMessage
as a fallback.
Example:
@HandleCommand
public void handle(MyCommand command, Message message) {
Instant timestamp = message.getTimestamp();
}
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class io.fluxcapacitor.common.handling.TypedParameterResolver
matches
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.fluxcapacitor.common.handling.ParameterResolver
determinesSpecificity, filterMessage
-
Constructor Details
-
MessageParameterResolver
public MessageParameterResolver()
-
-
Method Details
-
resolve
Description copied from interface:ParameterResolver
Resolves aParameter
of a handler method into a value function based on the given message.If the parameter cannot be resolved by this resolver and
ParameterResolver.matches(java.lang.reflect.Parameter, java.lang.annotation.Annotation, M)
is not implemented, this method must returnnull
.- Parameters:
p
- the parameter to resolvemethodAnnotation
- the annotation present on the handler method (e.g.,@HandleEvent
)- Returns:
- a function that takes a message and returns a value to be injected into the method parameter, or
null
if the parameter cannot be resolved andParameterResolver.matches(java.lang.reflect.Parameter, java.lang.annotation.Annotation, M)
is not implemented.
-