DocumentAfterUpdateEvent timing details

We are trying to replicate changes to A12 documents to an external system.

But I can’t find an event which is trigger by A12 after the (modified or new) document was persisted and the transaction was committed.

So in theory when using DocumentAfterUpdateEvent to send the updated data to the external system, the document might not have been persisted, because something could go wrong between the event and the end of the transaction.

The question is: what can go wrong between DocumentAfterUpdateEvent and the final commit of the transaction? I assume all A12 validations have successfully been applied and all relationships were checked. So in theory only technical problems (e.g. server goes down) can prevent a successful commit, right?

We are doing the actual sending asynchronously in order to not block the saving of the document.
If the reading of the modified document is done through DataServices (RPC calls) in the asynchronous thread, then I assume I will get the modified document even when the database transaction hasn’t committed yet. Is that assumption correct?

The same question arises when using DocumentAfterCreateEvent

If those two events aren’t suited for what we want to do, then what is the alternative?

Have you tried using a @TransactionEventListener for the DocumentAfterUpdateEvent? Dataservices events are just build on top of the usual spring events. And for those purposes a @TransactionalEventListener will run once the current transaction is commited by default (or by choosing another transaction phase by specifying it in the annotation usage) .

Thanks, that works