When designing a web application using microservices, is RPC or event sourcing the better approach for communication between microservices? It seems like you have to pick one or the other. For example:
RPC:
- HTTP server gets a request to view a user profile page
- HTTP server makes RPC request to some UserService to lookup the profile
- UserService sends reply with the profile
- HTTP server sends back the profile to the browser
Event sourcing:
- HTTP server gets a request to view a user profile page
- HTTP server generates an event to a message queue to request the profile
- UserService is a subscriber of the queue and processes the request event
- UserService generates a reply event containing the profile information to another message queue
- HTTP server is a subscriber of the queue and sends back the profile to the browser
Aucun commentaire:
Enregistrer un commentaire