Functions

beginTransaction

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

beginTransaction

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

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.