Latest QLDB Driver updates for Nodejs
- 2 minutes read - 267 wordsBackground
In a previous blog post I wrote about the significant improvements made in the Amazon QLDB driver for Nodejs. At the time it had gone to 1.0.0-rc.1
, and following some more updates, it has now gone to v1.0.0
.
Significant Updates
In this period, there were three important updates. For more details check out the release notes
Session pooling functionality moved to QldbDriver
In previous versions, there was both a QldbDriver
and a PooledQldbDriver
with strong recommendations to use the PooledQldbDriver
to enable a pool of sessions maintained for you that reuse underlying connections. As the standard implementation, this pooling functionality is now moved into the standard driver, with the PooledQldbDriver
being removed in future versions
Use executeLambda
method on the driver
In my previous examples, I had been using executeLambda
on a QldbSession
instance. It is now recommended to use it on the driver instance. The executeLambda
method on the session instance is marked as deprecated and will be removed in future iterations. The biggest advantage for me is that I no longer have to explicitly open and close sessions, and my code is simplified from:
let qldbDriver: QldbDriver = new QldbDriver(..);
let session: QldbSession = await qldbDriver.getSession();
session.executeLambda(..)
session.close()
to:
let qldbDriver: QldbDriver = new QldbDriver(..);
qldbDriver.executeLambda(..)
Helper method getTableNames
now available on the driver instance
The final update is the addition of the getTableNames
helper method to list all tables present in a ledger on the QldbDriver
.
Simple Demo
I previously put together a simple QLDB demo which I’ve now updated to reflect these updates. You can check it out at this GitHub repo