Skip to content

Parameter resolvers

A handler can ask for message context directly in its parameters. You do not need to look up the current message or pass its timestamp through your own helper methods.

For example, add an Instant parameter to receive the event’s timestamp:

@HandleEvent
void handle(CreateUser event, Instant timestamp) {
log.info("User created at {}", timestamp);
}

Fluxzero resolves handler arguments by their type and annotations. You normally only declare the parameters you need.

By default, Fluxzero supports injection of the following parameters into handler methods:

  • The message payload (automatically matched by type)
  • The full Message, Schedule, or WebRequest
  • The raw DeserializingMessage or SerializedMessage (for low-level access)
  • The message Metadata
  • The message timestamp as Instant or Clock
  • The currently authenticated User (if available)
  • The associated Entity wrapper or the entity value itself
  • The triggering message (annotated with @Trigger)
  • Any Spring bean (when Spring integration is enabled)

Other contextual values like message ID, timestamp, etc. can be obtained from the Message.


Add a resolver when your application has a context type that the SDK does not know. Here RequestOrigin groups an optional source metadata value; it is descriptive context, not a trusted authentication identity.

public record RequestOrigin(String source) {}
public class RequestOriginResolver implements ParameterResolver<DeserializingMessage> {
@Override
public Function<DeserializingMessage, Object> resolve(Parameter parameter, Annotation methodAnnotation) {
if (parameter.getType().equals(RequestOrigin.class)) {
return message -> new RequestOrigin(message.getMetadata().get("source"));
}
return null;
}
}

Register it on your application’s FluxzeroBuilder builder before building the client:

builder.addParameterResolver(new RequestOriginResolver());

Then request that type in a handler:

@HandleCommand
void handle(CreateOrder command, RequestOrigin origin) {
log.info("Order requested from {}", origin.source());
}

Return null from resolve for parameters your resolver does not recognize, so other resolvers can handle them.

  • Injecting request-specific context (e.g. tracing info)
  • Supporting custom annotations (e.g. @FromHeader)
  • Enabling access to correlated data (e.g. parent entity)
  • Binding to environment or system values

See ParameterResolver for the resolver contract and matching options.


© 2026 Fluxzero