I have looking for the best approach to handle error handling and retries for the following business feature.
begin business transaction
-
User logs unto a website and triggers next step by clicking a button
-
Book a venue : this calls a spring boot microservice which insert record to secure booking
-
Send confirmation letter user
-
calls multiple springboot micro-services to fetch letter details and aggregates the data
-
generate letter by calling pdf generation microservice
-
sends letter by calling a external API
-
Log an event using a messaging queue
-
finish business transaction
The above flow is implemented in a restful endpoint The steps is called from a Java method, but steps 2 and 3a,b and c are delegates to sub methods.
My question is, what is the best approach to achieve a transaction like operation for this functionality, so that : - if booking venue (db insert) fails the letter is not sent out - if the notification fails, the database insert should be rolled back
I know about the @Transactional https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/transaction/annotation/Transactional.html
But, I will like a few ideas of pattern for this.
All the methods invoked have exception handling using @ControllerAdvice
Is there a Java @Transactional wrapper used to perform the following events - ( database operation, file reads, asynchronous call, messaging etc) as an atomic operation
Any ideas will be appreciated
Aucun commentaire:
Enregistrer un commentaire