The TrmUserTransaction class has methods that allows an application to create transaction boundaries, such as for begin, commit, or roll back. A Node.js application must create an instance of this class and use the instance methods for transaction demarcation.

Hierarchy

  • TrmUserTransaction

Constructors

  • Intialize a user transaction

    Parameters

    • Optional gtrid: string

      global transaction id

    • Optional timeout: number

      transaction timeout value in milliseconds

    Returns TrmUserTransaction

Methods

  • Starts a new user transaction

    Parameters

    • req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>

      Express request object

    • Optional enlist: boolean

      true, if current request needs to enlist in the transaction

    Returns Promise<void>

  • Commits the transaction

    Parameters

    • req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>

      Express request object

    Returns Promise<void>

  • Executes a transaction

    Parameters

    • req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>

      Express request object

    • func: Function

      The function to execute as part of the transaction

    • Rest ...args: any[]

      The arguments to pass to the func mentioned

    Returns Promise<unknown>

  • Obtain the status of the transaction. If no transaction is started, this method returns the 0 value

    Parameters

    • req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>

      Express request object

    Returns Promise<number>

  • Get the GTRID of the transaction

    Returns string

    the GTRID of the transaction

  • Get timeout in milliseconds

    Returns number

    timeout in milliseconds

  • Get the transaction URL

    Returns string

    the transaction URL

  • Resumes the transaction

    Returns void

  • Abort the transaction immediately, so that all pending changes are discarded.

    Parameters

    • req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>

      Express request object

    Returns Promise<void>

  • Modify the state of the current transaction. So that a rollback is the only possible outcome, but do not perform the rollback yet

    Returns void

  • Modifies the timeout value in seconds that is associated with the transaction started with the begin method. If the transaction is not began, this methods throws an error If an application has not called this method, the transaction service uses a default value for the transaction timeout

    Parameters

    • timeout: number

      timeout in milliseconds

    Returns void

  • Suspends the transaction

    Returns void

Copyright © 2022, 2024, Oracle and/or its affiliates.