txnAbort
Discard a transaction's writes without waiting for its timeout.
txnAbort(request: TxnAbortRequest): Promise<TxnAbortResponse>Parameters
ParameterTypeRequired
txnIdUUID bytesrequiredThe transaction to discard.
Returns
FieldTypePresence
txnIdUUID bytesalwaysEchoed back.
operationsDiscardedintegeralwaysHow many operations were thrown away.
Example
const txnId = newId();
await client.txnBegin({ txnId, timeoutSeconds: 30 });
try {
await writeEverything(txnId);
const res = await client.txnCommit({ txnId });
console.log(`applied ${res.operationsApplied}`);
} catch (e) {
await client.txnAbort({ txnId });
throw e;
}HTTP has no transactions
The HTTP edge exposes no transaction routes. Each HTTP verb is its own unit. If several writes must land together, you need the wire client — see Wire client.
Was this page helpful?