Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class AR1{
- Integer id;
- DomainService ds;
- //OPTION 1
- void createAr2RootOpt1(){
- AR2 ar2 = new AR2();
- ds.saveToRepo(ar2);
- }
- //OPTION 2
- void createAr2RootOpt2(){
- publishEvent(new SholdCreateAR2Event()); //we don't need this event. Shoud it still be preserved in event store?
- }
- }
- class AR2{
- Integer id;
- Integer ar1Id;
- void handle(CreateAR2Command command){
- //init this AR with values and save
- publishEvent(AR2CreatedEvent()); //used for projections afterwards and saved inside AR2 event store
- }
- }
- class Saga{
- void handle(SholdCreateAR2Event ev){
- emitCommand(new CreateAR2Command());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement