I am facing this problem and would like to review my approach to it here.
Clientsends an HTTP request to
Service Aand is expecting an answer.
Service Ais connected to
DB A. When it receives a request from
Client, it should save it in
DB Aand forward it to
Service B. If it already exists, it should return a failure.
Service Bis connected to
DB B. When it receives a request from
Service A, it should save it in
DB B. If it already exists, it should return a failure which is propagated back to the
How can one design such a system so that:
- The Client does not block forever
DB BDO NOT contain duplicated data
- Both services conform to a Microservices architecture (i.e., some downtime is expected).
One way i thought would be good to design it is to split the Client request into two: one to post the data without expecting an answer, and another request to query the data in question if it was successfully inserted. This avoids blocking the client. Both Services would need to have a queue.
Am i overlooking something fundamental in the design?
Many thanks in advance