0

So I've been doing some research around Event Driven design for Microservice architecture to help decouple some of the microservices I've been helping develop. Currently the problem I've been running into is that each microservice is calling other microservices directly for data which seems to be tightly coupling them and is outlined in the following article:

https://thenewstack.io/synchronous-rest-turns-microservices-back-monoliths/

So event driven architecture seems to help with the overall design but where I get confused at is how would a GET request work for data if the API that is called needs data from another service? Would it post a request into a bus and subscribe for an answer? Do you just have to wait then for a response possibly delaying the response to the consumer?

Or is this a case where you would need to call another API directly? Any resources would be very much appreciated.

Joel Holmes
  • 943
  • 2
  • 12
  • 23
  • 1
    *how would a GET request work...?* There would be no GET request, because the service would already have all the data it needs from the other service. How? This is where event driven architecture can help. The service already has all the data it needs because it has a subscription to the other service's events. – tom redfern Jul 26 '17 at 13:50

1 Answers1

0

The book Microservice Architecture contains good examples of event sourcing (Chapter 5) as it models a parcel-delivery company. The idea behind event sourcing is that:

Instead of storing structures that model the state of our world, we can store events that lead to the current state of our world

That means that instead of sharing data among microservices, you store the state of an event that is the result of another async microservice call. Such state will be made available to other microservices. Please check the book for complete example and description.

AR1
  • 4,507
  • 4
  • 26
  • 42