Functions - transactions

ballerina/transactions:0.5.0.<init>0
ballerina/transactions:0.5.0.<init>1
ballerina/transactions:0.5.0.<init>2
ballerina/transactions:0.5.0.<init>3
ballerina/transactions:0.5.0.<init>4
beginTransaction
Deprecated When a transaction block in Ballerina code begins, it will call this function to begin a transaction.
cleanupTransactionContext
Deprecated Cleanup the transaction context.
endTransaction
Deprecated When a transaction block in Ballerina code ends, it will call this function to end a transaction.
getAndClearFailure
Deprecated Get and Cleanup the failure.
getCurrentTransactionId
Deprecated Get the current transaction id.
rollbackTransaction
Deprecated Rollback the transaction.
setTransactionContext
Deprecated Set the transactionContext.

ballerina/transactions:0.5.0.<init>0

()

returns error?

ballerina/transactions:0.5.0.<init>1

()

returns error?

ballerina/transactions:0.5.0.<init>2

()

returns error?

ballerina/transactions:0.5.0.<init>3

()

returns error?

ballerina/transactions:0.5.0.<init>4

()

returns error?

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.

cleanupTransactionContext

(string transactionBlockId)

Deprecated Cleanup the transaction context.

Parameters

  • transactionBlockId string
  • ID of the transaction block.

endTransaction

(string transactionId, string transactionBlockId)

returns string | error
Deprecated 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.

getAndClearFailure

()

returns boolean
Deprecated Get and Cleanup the failure.
  • Return Type

    (boolean)
  • is failed.

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.

rollbackTransaction

(string transactionBlockId, error? err)

Deprecated Rollback the transaction.

Parameters

  • transactionBlockId string
  • ID of the transaction block.

  • err error? (default <error?> ())
  • The cause of the rollback.

setTransactionContext

(TransactionContext transactionContext, Info? prevAttempt)

Deprecated Set the transactionContext.

Parameters

  • prevAttempt Info? (default <ballerina/transactions:0.5.0:Info?> ())
  • Information related to previous attempt.