Supported Parameters for Annotated Handlers
This chapter provides an exhaustive list of all the possible parameters for annotated message handling functions.
The framework resolves the parameters for any message handling function through an internal mechanism, called
the ParameterResolver
.
The ParameterResolver
, built by a ParameterResolverFactory
, is in charge of inserting the parameters for the
command, event and query handlers.
The set of ParameterResolvers
can be extended if custom (or not yet) supported parameters should be injected in to
your annotated handlers.
You can configure additional ParameterResolvers
by implementing the ParameterResolverFactory
interface and
configuring the new implementation.
For more specifics on configuring custom `ParameterResolver`s we suggest
reading this section.
Supported parameters for command handlers
By default, @CommandHandler
annotated methods allow the following parameter types.
Parameter designation | Purpose |
---|---|
The first parameter |
The first parameter is always the payload of the command message. It may also be of type: |
type: |
Will contain the entire metadata of a |
annotated with |
Will resolve the metadata value with the key as indicated on the annotation. If |
type: |
Will get the complete message, with both the payload and the metadata. Resolving the entire |
type: |
Will get the current unit of work injected. The |
type: |
Will resolve the identifier of the handled |
type: |
Will resolve the configured |
type: |
Will resolve the chain of |
subtype of |
The scope descriptor is helpful when scheduling a deadline through the |
Spring Bean |
If the application runs in a Spring environment, any Spring Bean can be resolved. The parameter can be the annotation with |
Supported parameters for event handlers
By default, @EventHandler
annotated methods allow the following parameter types.
Parameter designation | Purpose |
---|---|
The first parameter |
The first parameter is the payload of the event message. If the event handler does not need access to the payload of the message, you can specify the expected payload type on the |
type: |
Will resolve the |
type: |
Will contain the entire metadata of a |
annotated with |
Will resolve the metadata value with the key as indicated on the annotation. If |
type: |
Will get the current unit of work injected. The |
type: |
Will resolve the identifier of the handled |
type: |
Will resolve to the timestamp of the |
type: |
Will resolve to the |
type: |
Will have the current token related to the processed event injected. Note that this will only work for |
type: |
Will resolve to the |
type: |
Will have the current dead letter related to the processed event injected. Note that the inserted field is nullable since there is no guarantee the event of the handler is a dead letter, yes or no. |
type: |
Will resolve to the ReplayStatus indicating whether the event is delivered as a 'REGULAR' event or a 'REPLAY' event. |
Spring Bean |
If the application runs in a Spring environment, any Spring Bean can be resolved. The parameter can be the annotation with |
Supported parameters for query handlers
By default, @QueryHandler
annotated methods allow the following parameter types.
Parameter designation | Purpose |
---|---|
The first parameter |
The first parameter is always the payload of the query message. It may also be of type: |
type: |
Will contain the entire metadata of a |
annotated with |
Will resolve the metadata value with the key as indicated on the annotation. If |
type: |
Will get the complete message, with both the payload and the metadata. Resolving the entire |
type: |
Will get the current unit of work injected. The |
type: |
Will resolve the identifier of the handled |
Spring Bean |
If the application runs in a Spring environment, any Spring Bean can be resolved. The parameter can be the annotation with |