C
C#2y ago
M B V R K

❔ 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
Mayor McCheese
microservices.io
Microservices Pattern: Event sourcing
Use event sourcing, which persists aggregates as a sequence of domain events
Mayor McCheese
This is a bit different than you likely mean; but is frequently used to create such info stores.
Mayor McCheese
either approach can work with rabbitmq
M B V R K
M B V R KOP2y ago
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?
Mayor McCheese
that's going to be use case dependent; I'm going to hazard, yes, but there could be other considerations.
M B V R K
M B V R KOP2y ago
Hmmmm can you give me some heads of threads by sharing your experience to understand And massive thanks in advance
Mayor McCheese
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.
M B V R K
M B V R KOP2y ago
Alright got it Massive thanks man I appreciate
Mayor McCheese
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.
Accord
Accord2y ago
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.

Did you find this page helpful?