I have an RDS database running Aurora (MySQL), and would like to trigger an AppSync GraphQL mutation when a row in an RDS table is either inserted or updated.
There's an answered question about how to trigger an AppSync mutation from RDS, and I'm able to do that successfully. My question, though, is how do you deal with the transactional nature of RDS? If I trigger an AppSync mutation (via Lambda) on a MySQL AFTER INSERT
or AFTER UPDATE
, I can do what I need with AppSync and it works great, but the problem is that these triggers run before committing the transaction. Which means, if the transaction is rolled back for any reason, the mutation has occurred but the database state has reverted to what it was previously.
Any suggestions on how to approach this? How to wait for a transaction to be committed before triggering an AppSync mutation?