Functions - transactions

getCurrentTransactionId

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.

registerParticipantWithRemoteInitiator

Registers a participant with the initiator's coordinator. This function will be called by the participant.

getCurrentTransactionId

()

returns string

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.

registerParticipantWithRemoteInitiator

(string transactionId, string transactionBlockId, string registerAtURL, RemoteProtocol[] participantProtocols)

returns TransactionContext | error

Registers a participant with the initiator's coordinator. This function will be called by the participant.

Parameters

  • transactionId string
  • Global transaction ID to which this participant is registering with.

  • transactionBlockId string
  • The local ID of the transaction block on the participant.

  • registerAtURL string
  • The URL of the coordinator.

  • participantProtocols RemoteProtocol[]
  • The coordination protocals supported by the participant.

  • Return Type

    (TransactionContext | error)
  • TransactionContext if the registration is successful or an error in case of a failure.