I have a Customer
container with items representing a single customer in SQL API (DocumentDB)
in CosmosDB
. I also have a Gremlin API (GraphDB)
with the customers' shoppingcart
data. Both these data are temporary/transient. The customer can choose clear shopping cart which will delete the temporary customer
and the shoppingcart
data.
Currently I make separate calls, one to the SQL API (DocumentDB)
and Gremlin API (GraphDB)
which works but I want to do both as a transaction (ACID principle). To delete a customer
, I call the Gremblin API
and delete the shoppingcart
data, then call the SQL API
to delete the customer
. But if deleting the customer with the SQL API
(second step) fails, I want to roll back the changes done in the first call which will roll back the shoppingcart
data which were deleted. In the T-SQL world, this is done with a commit
and rollback
.
How can I achieve distributed transaction coordination around the delete operations of the customer
and shoppingcart
data?