Communication between micro services

Asked

Viewed 61 times

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.

  1. Customer: all customer data.
  2. Catalogue: all product details, including price.
  3. 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.

  • 1

    take a look at messaging services, such as rabbitmq

  • @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.

  • 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

  • @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.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.