Ok, I was not quite correct. I could register a Synchronization instance with javax.transaction.Tramsaction, or I could have my session beans implement SessionSynchronization.
However I don't see an equivalent "MessageDrivenSynchronization" capability for MDBs.
My experience of registering against javax.transaction.Transaction is that other infrastructure components do the same, and that the order of invocation of afterCompletion(boolean) is non-deterministic. The problem comes when an infrastructure component treats afterCompletion() as the place where it will do its own commit work. So my Synchronization instance is often called BEFORE all the commit work has been done.
Is the Synchronization interface conceptually missing another entrypoint? We have one for before-commit, one for after-completion, but none for commit-now, so some adaptors use after-completion for that purpose....
We have resolved this issue.
Kind regards, Robin.