Annotation Interface AggregateMember
Field or Method that references one or
more Entities capable of handling Commands or Events. The annotation may be placed on a member referencing a single
Entity, a member referencing a Collection of Entities, or a Map containing Entities mapped by their identifier.
If the annotation is placed on a Collection of Entities, an Entity is selected for Command handling based on the
Entity's identifier and the value of the routing key property on the Command. See EntityId for more
information.
If the annotation is placed on a Map of Entities, the key of the Map should be equal to the Entity's identifier. Note
that Entities in the Map still need to specify which routing key to use. To that end Entities should contain a EntityId annotated identifier field. Usually it is advantageous in terms of performance to store Entities in a Map
instead of Collection.
Note that if the designated Aggregate member has CommandHandler annotations to handle Command message, that
those may not be placed on an non-root Entity's constructor.
- Since:
- 3.0
- Author:
- Allard Buijze
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionClass<? extends ForwardingMode> Indicates the forwarding mode used for events within this entity.booleanIndicates whether commands should be forwarded to this AggregateMember.The property of the message to be used as a routing key towards this Aggregate Member.Class<?> Provides the member's type.
-
Element Details
-
forwardCommands
boolean forwardCommandsIndicates whether commands should be forwarded to this AggregateMember. Defaults totrue.- Default:
true
-
eventForwardingMode
Class<? extends ForwardingMode> eventForwardingModeIndicates the forwarding mode used for events within this entity. Defaults toForwardToAllto forward all events to all entities referred to by the annotated field.- Default:
org.axonframework.modelling.command.ForwardToAll.class
-
routingKey
String routingKeyThe property of the message to be used as a routing key towards this Aggregate Member. Defaults to"", which deeper down defaults to theEntityIdannotated field or that annotation itsroutingKeyproperty.- Default:
""
-
type
Class<?> typeProvides the member's type. By default the type of member is determined from the field's (generic) type.- Default:
java.lang.Void.class
-