├── HANDS ON EVENT SOURCING & CQRS.odp ├── .gitignore └── README.md /HANDS ON EVENT SOURCING & CQRS.odp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ylegat/workshop-event-sourcing/HEAD/HANDS ON EVENT SOURCING & CQRS.odp -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | 11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 12 | hs_err_pid* 13 | 14 | .idea/ 15 | target/ 16 | *.iml -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **step 1: simple command** 2 | 3 | ``` 4 | git merge --no-edit origin/step1/exercise/simple-command 5 | ``` 6 | 7 | We want to implement the 3 basic commands that can be applied on a bank account: registration (creation), provisioning and withdraw 8 | 9 | 1. implement account registration command 10 | * write BankAccount_registerBankAccountTest.should_register_bank_account_with_success test and make it pass 11 | * write BankAccount_registerBankAccountTest.should_fail_registering_bank_account_with_already_used_id and make it pass 12 | 2. implement provisioning command, using BankAccount_provisionCreditTest as a guideline 13 | 3. implement withdraw command, using BankAccount_withdrawCreditTest as a guideline 14 | 15 | 16 | **step 2: long running process** 17 | 18 | * if you managed to make all the tests pass: 19 | ``` 20 | git add . 21 | git commit -m "solution" 22 | git merge --no-edit origin/step2/exercise/long-running-process 23 | ``` 24 | 25 | * if you want to continue from a clean solution 26 | ``` 27 | git add . 28 | git reset --hard origin/master 29 | git merge --no-edit origin/step1/solution/simple-command 30 | git merge --no-edit origin/step2/exercise/long-running-process 31 | ``` 32 | 33 | A transfer is a long running process: an operation that is decomposed into multiple simple commands, orchestrated by a process manager. 34 | The process manager dedicated to a transfer is named TransferProcessManager. 35 | 36 | Commands related to this operation are: request transfer, receive transfer, cancel transfer and complete transfer 37 | All commands have already been implemented except the first one. 38 | 39 | 1. implement the transfer process manager 40 | * write TransferProcessManagerTest.should_cancel_transfer_when_destination_does_not_exist test and make it pass 41 | * write TransferProcessManagerTest.should_complete_transfer_when_destination_exist test and make it pass 42 | 43 | 44 | **step 3: projection** 45 | 46 | * if you managed to make all the tests pass: 47 | ``` 48 | git add . 49 | git commit -m "solution" 50 | git merge --no-edit origin/step3/exercise/projection 51 | ``` 52 | 53 | * if you want to continue from a clean solution 54 | ``` 55 | git add . 56 | git reset --hard origin/master 57 | git merge --no-edit origin/step2/solution/long-running-process 58 | git merge --no-edit origin/step3/exercise/projection 59 | ``` 60 | 61 | We need a read model containing the total balance of the accounts. 62 | For this, we use a in memory repository named InMemoryBalanceRepository (already implemented) 63 | 64 | We need to implement the projection manager, BalanceProjectionManager, that will be notified when an event is saved so that it can update the total balances using the repository. 65 | 66 | 1. implement the credit balance projection manager 67 | * make the tests defined in BalanceProjectionManagerTest pass 68 | 69 | 70 | **step 4 (optional): create a projection of your own** 71 | --------------------------------------------------------------------------------