@Documented @Target(value={FIELD,METHOD,ANNOTATION_TYPE}) @Retention(value=RUNTIME) public @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.
Modifier and Type | Optional Element and Description |
---|---|
Class<? extends ForwardingMode> |
eventForwardingMode
Indicates the forwarding mode used for events within this entity.
|
boolean |
forwardCommands
Indicates whether commands should be forwarded to this AggregateMember.
|
String |
routingKey
The property of the message to be used as a routing key towards this Aggregate Member.
|
Class<?> |
type
Provides the member's type.
|
public abstract boolean forwardCommands
true
.public abstract Class<? extends ForwardingMode> eventForwardingMode
ForwardToAll
to forward all
events to all entities referred to by the annotated field.public abstract Class<?> type
Copyright © 2010–2020. All rights reserved.