๐ด Important [19th Feb 2022 : 03:12] Now I realized that I should have used write concern as majority for preventing data inconsistency that can be caused by primarydb failures which primarydb cannot be able to replicate its data to replicas. (Tunable consistency in MongoDB @see https://youtu.be/x5UuQL9rA1c?t=555)
- Get with body. :(
- In some parts business logic layer and persistence layer mixed (Like order creation.). :(
- Codes could have been cleaner. :(
ReadingIsGood service is service that serve to ReadingIsGood firm that sells books online. You can create book, customer, order, inventory as well as get statistics.
To use service, you need to only run 2 different steps; First create package then use docker compose command. Database and application will bring up and will be ready for usage:
mvn clean package -DskipTests
docker compose up
I prepared swagger documentation. You can look this page for all controllers and usages.
ReadingIsGood Service Documentation
- Java 11
- MongoDB 4.4
- Spring Boot 2.6.3
- Docker, Docker Compose
- For preventing partial updates, lost updates(Specific form of write skew)
and similiar concurrency issues I used;
- Optimistic Locking with Versions.
- MongoDB multi document transactions(since MongoDB 4)
- MongoDB atomic updates.
- For getting statistics info I used;
- MongoDB Aggregations
- For securing endpoints I used;
- JWT token
login: [email protected]
password: 123456
Note: Assumption made for TimeZone which is UTC. So when
apply date criteria regard timezone.
Note: While testing orders between dates use Postman.
Because swagger-ui does not support GET request with body.
See below example request(Also do not forget to add bearer token in headers)