• Public
  • Public/Protected
  • All

Use QldbDriver instead





  • new PooledQldbDriver(ledgerName: string, qldbClientOptions?: ClientConfiguration, retryLimit?: number, poolLimit?: number, timeoutMillis?: number): PooledQldbDriver


Protected _isClosed

_isClosed: boolean

Protected _ledgerName

_ledgerName: string

Protected _qldbClient

_qldbClient: QLDBSession

Protected _retryLimit

_retryLimit: number


Protected _throwIfClosed

  • _throwIfClosed(): void


  • close(): void
  • This is a driver shutdown method which closes all the sessions and marks the driver as closed. Once the driver is closed, no transactions can be executed on that driver instance.

    Note: There is no corresponding open method and the only option is to instantiate another driver.

    Returns void


  • executeLambda(transactionFuntion: function, retryIndicator?: function): Promise<any>
  • This is the primary method to execute a transaction against Amazon QLDB ledger.

    When this method is invoked, the driver will acquire a Transaction and hand it to the TransactionExecutor you passed via the transactionFunction parameter. Once the transactionFunction's execution is done, the driver will try to commit the transaction. If there is a failure along the way, the driver will retry the entire transaction block. This would mean that your code inside the transactionFunction function should be idempotent.

    You can also return the results from the transactionFunction. Here is an example code of executing a transaction

    let result = driver.executeLambda(async (txn:TransactionExecutor) => {
      let a = await txn.execute("SELECT a from Table1");
      let b = await txn.execute("SELECT b from Table2");
      return {a: a, b: b};

    Please keep in mind that the entire transaction will be committed once all the code inside the transactionFunction is executed. So for the above example the values inside the transactionFunction, a and b, are speculative values. If the commit of the transaction fails, the entire transactionFunction will be retried.

    The function passed via retryIndicator parameter is invoked whenever there is a failure and the driver is about to retry the transaction. The retryIndicator will be called with the current attempt number.


    • transactionFuntion: function
    • Optional retryIndicator: function

      An Optional function which will be invoked when the transactionFunction is about to be retried due to a failure.

        • (retryAttempt: number): void
        • Parameters

          • retryAttempt: number

          Returns void

    Returns Promise<any>


  • deprecated

    [NOT RECOMMENDED] It is not recommended to use this method during transaction execution. Instead, please use QldbDriver.executeLambda to execute the transaction.

    Create and return a newly instantiated QldbSession object. This will implicitly start a new session with QLDB.


    DriverClosedError when this driver is closed.

    Returns Promise<QldbSession>

    Promise which fulfills with a QldbSession.


  • getTableNames(): Promise<string[]>

Generated using TypeDoc