This repository has been archived by the owner on Nov 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 97
Core Transactions
asafka edited this page Dec 19, 2017
·
18 revisions
Xenon has built-in support for transactions. A transaction enables a client to perform multiple operations on multiple documents (of the same kind or of different kinds) in a single logical unit, which is isolated from other logical units, and succeed or fails atomically.
Implementation of core transactions is optimistic. One implication is that a client needs to check the result of a COMMIT request - the request might fail due to confloicts with other transactions.
Typical usage flow of transactions: *A Client creates a new transaction, by sending a POST to the transaction service
- The client associates one or more operations with the transaction, by setting the transactionId property on the operation
- The client sends the operations to their targets
- If one of the operation fails, the client aborts the transaction by constructing and sending an ABORT request to the transaction service. If all the operations succeed a client attempts to commit the transaction by constructing and sending a COMMIT request to the transaction service. The client checks whether commit request has succeeded or failed; if it failed, the client can use one of multiple techniques to cope with the failure, like re-trying (starting a new transaction...) or propagating the failure to its client.