In AWS QLDB, I execute the below lambda:
await qldbDriver.executeLambda(async (txn: TransactionExecutor) => {
const check = (await txn.execute('SELECT * FROM Accounts WHERE owner = ?', document.owner)).getResultList();
if (check.length === 0) {
await txn.execute('INSERT INTO Accounts ?', document)
}
});
The above transaction is idempotent. If I test the transaction by running it multiple times (with the same owner
) in parallel, I conclude that the transaction works as expected, and only a single Account
is inserted into QLDB.
QUESTION: Is there any way to know (via callback or rejected promise) if a transaction fails or is successfully committed??
Thanks