see: ./twitter-docker/twitter-docker-services/src/docker-compose.yml
this repo demonstrate CQRS data transfer in REST API and messaging microservices. it’s containing (async RabbitMQ messaging
and sync REST
microservices) data models processing:
-
main idea here is: each microservice doing single simple job, but doing it well, efficient and fast
-
actor 1:
twitter-data
- single service which is listenning creation entity command (event) and store input data into RDBMS (Postgre SQL) -
actor 2: scalable
twitter-commander
service, which is send async tweets creation commands -
actor 3: scalable
twitter-query
service, which is only reading tweets from read-only datasorce. in production systems should be moved out from operational RDBMS to some nosql scalable / replicateble solution, such mongodb, or any other more siutable for you -
in addition: common reusable subprojects, such domain and entity api…
-
important keywords:
-
CQRS, event sourcing
-
reactive streams, event-driven architecture
-
messaging pipelines, non-blocking data processing
-
[client] <-> (http get) <-> [twitter-query] <-> (jdbc select) <-> [rdbms]
# with webflux and reactive data-source could also be non blocking:
[client] <~> (http get sse) <~> [twitter-query (webflux)] <~> (reactive flux) <~> [mongo]
[client] -> (http post) -> [twitter-command] ~> (send async) ~> [twitter-data] <-> (jdbc insert) <-> [rdbms]
note:
-
<->
- sync processing -
<~>
- async processing
gradle --parallel bootRun
http post :8881 data=test-tweet1
http post :8881 data=test-tweet2
http get :8882
gradle --stop