Event Bus based Micro-service architecture's very basic implementation for understanding.
A very basic exmaple for understanding the EventBased Micro-Service architecture with react based client.
Client ->
- Allow user to create Posts
- Show All the posts created by all users
- Allow user to add comments to specific posts.
- Show All comments for the post inside the Post component.
- Show comment based on if the comment is approved or rejected.
PostService ->
- Provides endpoint for creating Post.
- Send Event to EventBus after Post is created.
CommentService ->
- Provide Endpoint for creating Comment for Post
- Send Event to EventBust After comment is created.
- Recieve Events related to comment moderation and send Event of comment updated to event bus.
QueryService ->
- Provides Endpoint for receiving all posts with their comments.
- Handles Comment Updated Event and updated local database to show latest status of comment.
Comment-Moderation->
- Handles Event of type CommentUpdated and status pending.
- Decides if comment should be approved or rejected.
- Send Event of CommentModerated to Event Bus
Event Bus ->
- Recieves Events from all the services.
- Send Received Events to all the services.