Functions

beginTransaction
D

When a transaction block in Ballerina code begins, it will call this function to begin a transaction.

getCurrentTransactionId
D

Get the current transaction id.

beginTransaction

function beginTransaction(string? transactionId, string transactionBlockId, string registerAtUrl, string coordinationType) returns TransactionContext | error
Deprecated

When a transaction block in Ballerina code begins, it will call this function to begin a transaction. If this is a new transaction (transactionId == () ), then this instance will become the initiator and will create a new transaction context. If the participant and initiator are in the same process, this transaction block will register with the local initiator via a local function call. If the participant and initiator are in different processes, this transaction block will register with the remote initiator via a network call.

Parameters

  • transactionId string?
  • Globally unique transaction ID. If this is a new transaction which is initiated, then this will be null. If this is a participant in an existing transaction, then it will have a value.

  • transactionBlockId string
  • ID of the transaction block. Each transaction block in a process has a unique ID.

  • registerAtUrl string
  • The URL of the initiator

  • coordinationType string
  • Coordination type of this transaction

Return Type

(TransactionContext | error)

Newly created/existing TransactionContext for this transaction.

Deprecated

getCurrentTransactionId

function getCurrentTransactionId() returns string
Deprecated

Get the current transaction id. This function is useful for user code to save state against a transaction ID, so that when the oncommit or onabort functions registered for a transaction can retrieve that state using the transaction that is passed in to those functions.

Return Type

(string)

A string representing the ID of the current transaction.

Deprecated