Functions
-
lang.transaction
abortResourceManagers |
Abort local resource managers. |
ballerina/lang.transaction:0.0.1.<init>0 |
|
ballerina/lang.transaction:0.0.1.<init>1 |
|
cleanupTransactionContext |
Cleanup the transaction context. |
commitResourceManagers |
Commit local resource managers. |
createTransactionContext |
A new transaction context is created by calling this function. |
endTransaction |
When a transaction block in Ballerina code ends, it will call this function to end a transaction. Ending a transaction by a participant has no effect because it is the initiator who can decide whether to commit or abort a transaction. Depending on the state of the transaction, the initiator decides to commit or abort the transaction. |
getAndClearFailure |
Get and Cleanup the failure. |
getData |
|
getInfo |
|
getRollbackOnly |
|
info |
|
isTransactional |
|
onCommit |
|
onRollback |
|
prepareResourceManagers |
Prepare local resource managers. |
rollbackTransaction |
Rollback the transaction. |
setData |
|
setRollbackOnly |
|
setTransactionContext |
Set the transactionContext. |
startTransaction |
|
Abort local resource managers.
Parameters
- transactionId string
-
Globally unique transaction ID.
- transactionBlockId string
-
ID of the transaction block. Each transaction block in a process has a unique ID.
-
Return Type
(boolean) true or false representing whether the resource manager abortion is successful or not.
Cleanup the transaction context.
Parameters
- transactionBlockId string
-
ID of the transaction block.
Commit local resource managers.
Parameters
- transactionId string
-
Globally unique transaction ID.
- transactionBlockId string
-
ID of the transaction block. Each transaction block in a process has a unique ID.
-
Return Type
(boolean) true or false representing whether the commit is successful or not.
createTransactionContext
(string coordinationType, string transactionBlockId)
returns TransactionContext | errorA new transaction context is created by calling this function. At this point, a transaction object corresponding to the coordinationType will also be created and stored as an initiated transaction.
Parameters
- coordinationType string
-
The type of the coordination relevant to the transaction block for which this TransactionContext is being created for.
- transactionBlockId string
-
The ID of the transaction block.
-
Return Type
(TransactionContext | error) TransactionContext if the coordination type is valid or an error in case of an invalid coordination type.
When a transaction block in Ballerina code ends, it will call this function to end a transaction. Ending a transaction by a participant has no effect because it is the initiator who can decide whether to commit or abort a transaction. Depending on the state of the transaction, the initiator decides to commit or abort the transaction.
Parameters
- transactionId string
-
Globally unique transaction ID.
- transactionBlockId string
-
ID of the transaction block. Each transaction block in a process has a unique ID.
-
Return Type
(string | Error?) A string or an error representing the transaction end succcess status or failure respectively.
Prepare local resource managers.
Parameters
- transactionId string
-
Globally unique transaction ID.
- transactionBlockId string
-
ID of the transaction block. Each transaction block in a process has a unique ID.
-
Return Type
(boolean) true or false representing whether the resource manager preparation is successful or not.
Rollback the transaction.
Parameters
- transactionBlockId string
-
ID of the transaction block.
- err error? (default <error?> ())
-
The cause of the rollback.
Set the transactionContext.
Parameters
- transactionContext TransactionContext
-
Transaction context.
- prevAttempt Info? (default <ballerina/lang.transaction:0.0.1:Info?> ())
-
Information related to previous attempt.