hibernate / hibernate-reactive

A reactive API for Hibernate ORM, supporting non-blocking database drivers and a reactive style of interaction with the database.
https://hibernate.org/reactive
Apache License 2.0
441 stars 92 forks source link

Consider adding an event handler for the transaction rollback #2015

Open alexpoletaev opened 2 days ago

alexpoletaev commented 2 days ago

Please consider adding a handler for the transaction rollback here, which will consume an exception and reactive session. This will allow to register observers for that event like it's possible for the before and after commit events. I'm using Quarkus with the hibernate reactive and I didn't find a way how to execute a peace of code (sending a Kafka message in my case) in case of transaction rollback for all the database entities. Also it would be great if those observers can be separated by the database operation events, something like INSERT_ROLLBACK, UPDATE_ROLLBACK, DELETE_ROLLBACK etc. Please let me know if I missed something and this is already implemented. Thanks in advance.