Search code examples
microservicesmessagebrokersagaorchestration

What is the best approach to communicate between services in event-driven design


As I know there is 2 different way to handle transaction in microservices (2PC and saga). The saga as mentioned here uses events that based on local transactions in each services. So when a local transaction has done or failed its job we should notify other services to process their job. The Questions is that what is the best approach to send and receive notifications throw microservices? A message broker (Which message broker is best one to handle )? or Rpc protocol? or something else?


Solution

  • In event-driven design you are quite free to handle how the events are propagated through your system.

    As a personal preference I would use a broker or event bus. That may depend on your usage of event distribution. If you want to support only a single receiver per topic then go with RabbitMQ or an alternative. When you have multiple receivers that are interested in the same topic I would suggest you to use Kafka. It is highly scaleable and quite easy to integrate in most languages.