Annotation Interface Trigger
If present on a parameter, the message that triggered the handled message is injected into the parameter if the parameter type is assignable from the trigger message type.
This is typically useful when handling results (using HandleResult) or errors (using HandleError). In
those handlers it is often useful to have access to the message that triggered the result or error.
Valid parameter types are types that can be assigned from the trigger message payload type, or Message or
DeserializingMessage. Using value() it is possible to filter what trigger messages to listen for. If
value() is left empty any trigger that matches the parameter is injected. Using messageType() it is
possible to filter the MessageType of the trigger message.
It is also possible to only listen for messages that were triggered by a given consumer using consumer().
-
Element Details
-
value
Class<?>[] valueFilter what trigger messages may be injected. Parameters are only injected if the trigger message payload type can be assigned to any of the given classes.If left empty, any trigger that matches the parameter is injected.
- Default:
- {}
-
messageType
MessageType[] messageTypeFilter what trigger messages may be injected. Parameters are only injected if the trigger message type is contained in the returned array, or if the array is left empty.- Default:
- {}
-
consumer
String[] consumerFilter on the name of the consumer that produced the handled message. If multiple values are given, the match is made if any of the mentioned consumers produced the message.This makes it easy to e.g. track results or errors produced by one or more consumers.
- Default:
- {}
-