Add README file with description of demo impl.

This commit is contained in:
zemo
2020-08-07 22:47:19 +02:00
parent e26a0f962a
commit feb89d108e
144 changed files with 65 additions and 2 deletions

0
.gitignore vendored Normal file → Executable file
View File

0
LICENSE Normal file → Executable file
View File

58
README.md Normal file
View File

@@ -0,0 +1,58 @@
# Bank account reactive DDD DEMO
This is the DDD reactive implementation of bank account example. The purpose of
this demo is to demonstrate how to deal with data consistence in the reactive implementation
using DDD (domain driven design) principles.
## List of design patterns used in this demo
* DDD
* message driven architecture
* event sourcing
* CQRS
## Technologies
This demo is implemented using Spring reactor project.
## The implementation consists by two aggregates
* `Account`
* `Transaction`
Those two aggregates representing one bounded context `Bank account`.
## Supported operation by Account aggregate
`account-domain-api` module contains definition of contract provided by `Account` aggregate.
Here is the list of basic operations:
* create account
* deposit money
* withdraw money
* transfer money between two accounts
## Supported operation by Transaction aggregate
`transaction-domain-api` module contains definition of contract provided by `Transaction` aggregate
Here is the list of basic operations:
* create transaction
* cancel/rollback transaction
* finish transaction
## Persistence
Implementation is following CQRS and event sourcing design pattern. Persistence API is provided by
`common-persistence-api`. This module provides in memory storage for:
* events generated by particular aggregate `AggregateRepositoryImpl`
* storage for view model `ViewRepositoryImpl`
## Business case representing of data consistency
* Create two accounts `A` and `B` with specific amount of money
* Create the transaction for transferring specific amount of money from account `A` to account `B`
* Transaction finished: successfully or failed
### Transaction is successful
* Transaction closes and informs about result.
### Transaction failed:
#### Failed due to account `A` doesn't have enough amount
* Transaction closes and informs about result.
#### Failed due to account `B` doesn't exist
* Transaction returns money to account `A`
* Transaction closes and informs about result.
#### Failed due to cancellation
* If money were withdrawn from account `A` -> money returns to account `A`
* Transaction closes and informs about cancellation.

0
bank-account/account/account-adapters/build.gradle Normal file → Executable file
View File

0
bank-account/account/account-api/build.gradle Normal file → Executable file
View File

0
bank-account/account/account-domain-api/build.gradle Normal file → Executable file
View File

0
bank-account/account/account-domain/build.gradle Normal file → Executable file
View File

0
bank-account/account/account-http-api/build.gradle Normal file → Executable file
View File

0
bank-account/account/account-impl/build.gradle Normal file → Executable file
View File

0
bank-account/bank-account-application/build.gradle Normal file → Executable file
View File

View File

@@ -7,6 +7,7 @@ import com.mz.reactor.ddd.reactorddd.account.http.AccountHandler;
import com.mz.reactor.ddd.reactorddd.transaction.api.TransactionHandler;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@@ -48,7 +49,8 @@ public class BankAccountAppConfiguration {
@Bean
@Primary
public ObjectMapper objectMapper(Jackson2ObjectMapperBuilder builder) {
public ObjectMapper objectMapper(Jackson2ObjectMapperBuilder builder, @Value("${test.composit-value}") String test) {
log.info(String.format("ZEMO!!!!! -> %s", test));
ObjectMapper objectMapper = builder.build();
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
return objectMapper;

View File

@@ -1,4 +1,7 @@
spring:
jackson:
serialization:
write-dates-as-timestamps: false
write-dates-as-timestamps: false
test:
composit-value: test.${TEST_VALUE:NOOO}-zemo

View File

0
bank-account/transaction/transaction-api/build.gradle Normal file → Executable file
View File

View File

View File

0
bank-account/transaction/transaction-impl/build.gradle Normal file → Executable file
View File

0
build.gradle Normal file → Executable file
View File

0
common-api/build.gradle Normal file → Executable file
View File

View File

Some files were not shown because too many files have changed in this diff Show More