event handling - DDD: How to solve this using Domain-Driven design? -


i'm new ddd , cutting teeth on following exercise. use case real, attempt solve ddd purely learning.

we have multiple git repos, each containing file call product spec. system needs respond http post cloning repos, , update product spec in match information in post body. system needs log post request cause updating product spec.

i'd use aggregates , event sourcing solving problem because seem fit. event sourcing comes automatic persistence of commands, if convert post body command, auditing free.

problem is, post may match multiple product spec. i'm not sure how deal that. should create domain service, let find matching product spec , issue update command each? or should have aggregate root so? if using aggregate root update multiple entities, needs entity, in problem domain?

the first comment question right (the 1 of @voiceofunreason): 'is side effect coordination'. try answer question: how solve using ddd / event sourcing:

  1. the first aggregate root named: 'multiplerepooperations'. aggregate root has 1 stream of events.
  2. the command fires whole process be: 'cloneandupdateprodspecrepos' carries list of repos cloned , updated.
  3. when aggregate root processes command spit bunch of events of type 'userrequestedtocloneandupdateprodspec'
  4. the second bounded context manages repos, , subscribed events 'multiplerepooperations' , receive each event emitted it. bounded context aggregate root can called: 'gitrepomanagement', , has stream per repo. eg: gitrepomanagement-repo1, gitrepomanagement-repo215, gitrepomanagement-20158, etc.
  5. 'gitrepomanagement' receives each event of type 'userrequestedtocloneandupdateprodspec', replays corresponding repo stream in order rehydrate current state, , tries clone , update product spec repo. when fails emits failed event or suceed if appropiate.

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -