is there any way to check when a transaction has c...
# exposed
m
is there any way to check when a transaction has completed successfully for good (including retries)?, it's not clear if
StatementInterceptor.afterExecution
is called for each retry too
c
Hi @minivac
afterExecution
is called after each statement is completed in a transaction, so it may be called multiple times in a single transaction if that transaction contains multiple SQL statements. So if
maxAttempts
for example is set to more than 1,
afterExecution()
will be called for each successful statement, on each attempt. If the number of statements in the transaction is potentially greater than 1,
afterCommit()
may be the better option depending on your use case. It is only implicitly called once, after a transaction has finally completed successfully, regardless of the number of attempts. Please note that
afterCommit()
will also be called if
commit()
is explicitly used in the transaction, as well as if the transaction includes a create table statement. And it will not be called at the end if the transaction ultimately fails all attempts.
👍 1
👍🏾 1