CQRS and event sourcing using plain embedded into jdk com.sun.net.httpserver
with dynamic groovy spock tests
this is an example of event sourced system I'm using for teaching my students, so please, don't even try use it in production: Also read: Why Developers Should Not Write Programs That Call 'sun' Packages
Status: in progress...
RoadMap:
Setup Gradle / Groovy repository with Spring IoC dependency injection and Spock test frameworkImplement REST API with plain java embedded http serverImplement basic REST API info and shutdown endpointsImplement and cover with tests User Account aggregate functionalityImplement and cover with tests User Account aggregate repository functionalityImplement user-account REST API endpointsImplement Friend Request aggregate functionalityImplement Friend Request aggregate repository functionality- Implement friend-request REST API endpoints
- Implement messenger aggregate functionality
- Implement messenger aggregate repository functionality
- Implement messenger REST API endpoints
- Implement async PubSub / Queue functionality to decouple direct REST API calls from aggregate repository
- Introduce read (query) side to avoid non efficient event sourcing repository querying
- Split current REST API into CQRS for eventual consistency and projections efficiency
- Implement CLI interface which is going to be interact with REST API by using CQRS
- Prepare future RoadMap for EventStore persistence introduction:
- MapDB
- JDBC
- JPA
- Spring Data
- NoSQL
- etc...
- Prepare future RoadMap for PubSub introduction:
- plain pub-sub patter implementation
- simple im-memory pub-sub solution from Google or Android library
- Using spring application events
- Kafka
NOTE: For better developer experience during testing, use idea cURL integration tests from rest-client*
files. Read more: https://www.jetbrains.com/help/idea/http-client-in-product-code-editor.html
just see how everything is clear in next analitics:
events:
- OrderCreated(id=123)
- ItemAdded(product=Bose Headphones, price=400)
- FollowSimilarItemsLink(product=Sony Headphones)
- AccessReviews()
- VoteReviewHelpful(answer=5/5)
- ItemAdded(product=Sony Headphones, price=450)
- ItemRemoved(product=Bose Headphones, price=400)
- OrderConfirmed()
- OrderShipped()
resources: