Take for example 2 different microservices, user
, address
and patient
with a gateway
.
Upon a creation of a patient, both user and address need to also be created. Therefore, let's say that a call to create a patient comes in from the frontend client:
POST /patient
host: gateway.com
content-type: application/json
{
"name" : "Patient Q. Public",
"address" : "address",
"email" : "p@p.com",
"password": "pass"
}
Upon receiving the request, the gateway must call three different microservices: address
, user
, and patient
, in that
order. Before commencing the first address
creation, a unique xid
is generated by the gateway.
Gateway makes a call to address to create an address record:
POST /address
HOST address.com
xa-id: xid
{
"address" : "address"
}
A address creation success responds with:
{
"addressId" : "aID"
}
...