lundi 13 mars 2017

Event sourcing vs RPC

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:

  1. HTTP server gets a request to view a user profile page
  2. HTTP server makes RPC request to some UserService to lookup the profile
  3. UserService sends reply with the profile
  4. HTTP server sends back the profile to the browser

Event sourcing:

  1. HTTP server gets a request to view a user profile page
  2. HTTP server generates an event to a message queue to request the profile
  3. UserService is a subscriber of the queue and processes the request event
  4. UserService generates a reply event containing the profile information to another message queue
  5. HTTP server is a subscriber of the queue and sends back the profile to the browser

Aucun commentaire:

Enregistrer un commentaire