Recording events in aggregate root

46 views
Skip to first unread message

Bojan Vukasovic

unread,
Mar 9, 2017, 11:01:14 AM3/9/17
to DDD/CQRS
How can I record entities in AR (and do reply) when I have e.g. 3 levels deep entities? Example: AR -> Entity1 -> Entity2

class AR{

List<Entity1> e1;

void run (Command c){
  e1.get(c.id).do(c.a);
}

}

class Entity1{

Entity2 e2;

void do(Integer x){
  e2.do2(x+1);
}

}

class Entity2{

Integer y;

void do(Integer y){
  apply(Entity2Evented(y));  <---------- how to bubble this event to AR? How to reply it on reading from event store?
}

when(Entity2Evented e){
 this.y = e;
}

}
Reply all
Reply to author
Forward
0 new messages