Annotation Interface EntityMember
eventTargetMatcher() and commandTargetResolver(), which both default to a matcher
based on the routingKey().
The default routing key matcher and resolver will match a property on the child entity annotated with
RoutingKey to a property of the message. The message property defaults to the name of the property in the
entity, but can be overridden through routingKey().
A RoutingKey property is required in all collection child entities when using the
RoutingKeyEventTargetMatcher as the eventForwardingMode or commandForwardingMode. For
singular child entities (not backed by an Iterable), this can be omitted.
Note that this annotation existed as org.axonframework.modelling.command.AggregateMember before version
5.0.0. Besides the change in name to align better with the entities instead of aggregates, the version introduced the
commandTargetResolver(), which before was not configurable.
- Since:
- 3.0.0
- Author:
- Allard Buijze, Mitchell Herrijgers
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionClass<? extends CommandTargetResolverDefinition> TheCommandTargetResolverDefinitionis used to determine to which of the child entities aCommandMessageshould be forwarded.Class<? extends EventTargetMatcherDefinition> TheEventTargetMatcheris used to determine which entity should be evolved by theEventMessage.The routing key to use for matching messages to this child entity.
-
Element Details
-
routingKey
String routingKeyThe routing key to use for matching messages to this child entity. Defaults to an empty string, which means the name of theRoutingKey-annotated property in the child entity will be used as the routing key.- Returns:
- The routing key to use for matching messages to this child entity.
- Default:
""
-
eventTargetMatcher
Class<? extends EventTargetMatcherDefinition> eventTargetMatcherTheEventTargetMatcheris used to determine which entity should be evolved by theEventMessage. The forwarding mode can match 0, 1, or multiple child entities, and as such functions like a predicate or filter.Defaults to using the
RoutingKeyEventTargetMatcher, which matches messages based on the routing key. Users can choose to create their own definition, and thus their own forwarding mode, that has specific routing logic.- Returns:
- The class defining the
EventTargetMatcherfor this child entity.
- Default:
org.axonframework.modelling.entity.annotation.RoutingKeyEventTargetMatcherDefinition.class
-
commandTargetResolver
Class<? extends CommandTargetResolverDefinition> commandTargetResolverTheCommandTargetResolverDefinitionis used to determine to which of the child entities aCommandMessageshould be forwarded. The result should always be a single child entity, or no child entity at all, as command can only be handled by a single entity.The result can also be
nullto indicate that no child entity should handle the command. This allows users to declare multiple fields with the same child entity type, but with differentRoutingKeyproperties, and thus different routing logic for commands.Defaults to using the
RoutingKeyCommandTargetResolverDefinition, which matches messages based on the routing key. Users can choose to create their own definition, and thus their own forwarding mode, that has specific routing logic.- Returns:
- The class defining
CommandTargetResolverfor this child entity.
- Default:
org.axonframework.modelling.entity.annotation.RoutingKeyCommandTargetResolverDefinition.class
-