❔ What is available approaches to communicate between Microservices
Hello dear friends,
Let's assume we have a project has the following Microservices (AuthMicroservice, ServiceA, ServiceB)
Lets assume that AuthService responsible about authentication and it contains an entiti/table called User.
In the service A and B there are some entities/tables which need the UserId of the User who is stored in AuthService,
In both service A and B when a new yser created in the AuthService's DB it automatically addded to tables (Users) in Services A and B, but without all the detailed info as in AuthService's DB
So what is best approach when a User created in the AuthService sent automatically to other services to store it in their tables?
I'm thinking to use the functionality of a message broker like RabbitMQ.
So from your experience what do you think?
11 Replies
microservices.io
Microservices Pattern: Event sourcing
Use event sourcing, which persists aggregates as a sequence of domain events
This is a bit different than you likely mean; but is frequently used to create such info stores.
Medium
Ruling the Event-Driven Architecture with RabbitMQ
Event-Driven Notification for complex systems
either approach can work with rabbitmq
I already Implementing the Event-sourcing in my project
It looks like that the RabbitMQ is the better way that fit any use
By the way what, I want service A to fetch/get some data from service B, is the best way for this purpose to call the API of the service B?
that's going to be use case dependent; I'm going to hazard,
yes
, but there could be other considerations.Hmmmm can you give me some heads of threads by sharing your experience to understand
And massive thanks in advance
so, in the event sourcing or event notification model http calls are fine because they aren't adding relevant latency, they're all participating in eventual consistency.
In the event of a human consumer focused api, you have other potential considerations; you want the already consistent data to read from ( ideally ), so you don't add latency; layer7-http-api's are too slow to keep calling under the covers in many cases, user expectations aren't met because it takes too long.
Alright got it
Massive thanks man
I appreciate
I have a couple inherited api's that make numerous calls under the covers to other api's via http; in cases of high traffic, it's 4-5 seconds to return. These all need to be rewritten.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.