DIVISION and rollback of transactions

I have several different RESTful services that are hosted on different servers that use different databases. I have several RESTful services that call several of these services above in what should be a transactional unit. As a result, we run into data consistency issues if any of these RESTful services fail. Is there a neat architectural way to organize rollback? Or do transaction managers have a way?

As a simplified example, RESTful 1 service has a POST request, which reduces the number of thingamajig elements by 1. RESTful service 2 POST - payment. If service 2 crashes, how can we cleanly roll back to service 1 without having a new RESTful return service (this is normal if this should be for you). I am looking for an architectural answer to the above question that is consistent with REST principles.

+4
source share
3 answers

, . . - . , . , , (-, , ..).

. wikipedia .

+1

: fooobar.com/questions/509462/... , REST , . , , , REST, . . , . , , REST.

:

  •    - . , , .., . REST REST, , . , REST- , , REST . REST. , 2 REST , .
  • REST , 202, . , , , REST . Ofc. REST, , , REST , , .
  • , ,    , POST . , , . POST /transactions/ {resource: "/forums/12/messages/45", method: "PUT", data: "..."} POST /transactions/1/commit , , PUT /forums/12/messages/45
+5

, (HTTP), - ( HTTP - -).

@leeor , , .

, , /transactions. POST ( ), - / GET. , / , .

Under the hood (during transaction creation), a snapshot (which can be canceled later) should be created for each resource participating in the transaction. Then, all operations should begin, and in the event of any failure, all images should be canceled. You do not mention any technology, so it is very difficult to advise something reasonable. What you need is a detailed logging.

0
source

Source: https://habr.com/ru/post/1611137/


All Articles