I have the below aggregate which contains an aggregate member.
@Aggregate
public class CpaAggregate {
@AggregateIdentifier
private String externalId;
@AggregateMember
private Entity entity;
public CpaAggregate() {
}
@CommandHandler
public CpaAggregate(CreateCpaCommand cmd) {
AggregateLifecycle.apply(new CpaCreatedEvent(...));
}
@EventSourcingHandler
protected void on(CpaCreatedEvent evt) {
....
}
}
public class Entity {
@EntityId
private String entityId;
private Set<Identifier> identifiers = new HashSet<>();
public Entity() {
}
@EventSourcingHandler
public void on(IdentifiantUpdatedEvent evt) {
...
}
}
public class Laboratory extends Entity {
private OperatingSystem operatingSystem;
public Laboratory() {
}
@CommandHandler
public void handle(UpdateIdentifierLABCommand cmd) {
AggregateLifecycle.apply(new IdentifiantUpdatedEvent(....));
}
}
commandGateway.sendAndWait(new UpdateIdentifierLABCommand(...));
When i send a command to update an identifier of entity of type laboratory, i get this error
org.axonframework.commandhandling.NoHandlerForCommandException: No handler was subscribed to command [UpdateIdentifierLABCommand]