lundi 8 janvier 2018

Canonical data model in Microservice architecture

Lets say i have 2 microservices (Service A, Service B) which can call each other both ways, lets say if A calls B then some parameters of response json of A will be consumed as some other parameter of request paramater of B

now i realized, this problem can be better addressed by using Canonical data model, so that each service consume/produce a canonical data model,

My question is how should a canonical model in this case(json) should look like

suppose response of A looks like

{
  "A1": false,
  "A2": {
    "width": 5,
    "height": 10
  },
  "A3": "A green door"
}

and there would be corresponding json schema, which i am not including here

Similarly request of B looks like

{
      "B1": false,
      "B2": {
        "width": 5,
        "height": 10
      },
      "B3": "A green door",
      "B4": ""
       .
       .

    }

Attribute A1 is mapped to B1, should my canonical data model only include this first attribute with some name (business name: eg -->A1 is score B1 -->Report then buisness name might be --> Points) that commonly relates to both the microservice or should it be more of a aggregation of both json with each attribute replaced with corresponding business name?

Aucun commentaire:

Enregistrer un commentaire