I have 2 REST apis where I "persist" data, in a "transaction". I'm curious to hear suggestions on how to ensure that if the 2nd one has trouble the first one could be "rolled back".
I currently have a retry loop and if that fails I send a delete to the first call.
It works fine, I was just curious if it is possible to use spring transactions to handle this.
For that matter, are there other options?
It would be very interesting and useful if something like this was possible, but I don't think it could be possible since there is no standard API for commits/rollbacks with REST APIs as there is with the JDBC API. With Spring, you could never simply mark a method as @Transactional
since Spring would have no idea how to "roll back" anything you did over a REST call without having to explicitly state it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With