0
Hello
I am developing an architecture in micro services dotnet a software in the retail area (retail, for who is en). I have three micro services: Client, Catalog and Command.
- Customer: all customer data.
- Catalogue: all product details, including price.
- Order: represents a purchase.
Has the following endpoints and expected responses:
Order
{
"idOrder" : number,
[
{ "idArticle" : number,
"quantity" : number
}
],
"idCustomer" : number,
"total" : number
}
Orderdetails:
{
"idOrder" : number,
[
{ "article" : {
"idArticle" : number,
"name" : string,
"price" : number,
"stock" : number,
"description" : string
},
"quantity" : number
}
],
"customer" : {
"idCustomer" : number,
"lastname" : string,
"firstname" : string,
"gender" : string,
"address" string,
"mail": string,
"phone": string
},
"total" : number
}
Customer:
{
"idCustomer" : number,
"lastname" : string,
"firstname" : string,
"gender" : string,
"address" string,
"mail": string,
"phone": string
}
Article:
{
"idArticle" : number,
"name" : string,
"price" : number,
"stock" : number,
"description" : string
}
To answer the Orderdetails endpoint, I need to communicate between the Order -> client and Order -> Article micro services. Do you know how best to communicate between Microservices based on events? I need to check if the article exists and if it has stock, it seems to me that it has to be a synchronous event.
Thank you.
take a look at messaging services, such as rabbitmq
– Lucas Miranda
@Thank you for the reply. But with messenger services I can do synchronous messages? This is the micro service Order can wait for a message? I thought it was only for asynchronous messages.
– alves
you can do it, but that would make me rethink the structure of your Microservices, since if you needed to scale, I would need to climb the 3, in my opinion if there is this strong dependency, the ideal is that they stay together, have to be very careful not to end up making a monolith disguised as microservice
– Lucas Miranda
@Lucasmiranda I understand what you’re saying but the truth is that the granularity of micro services is also important. If it’s not too thin tmb we start to have a monolithic disguised.
– alves