In certain scenarios, the implementation requires that while calling a set of services/APIs the DB commit should not happen after each API or service execution. The data should be committed once all the executions have been completed successfully.
For example, one such flow could be
Requirement here is to commit the result to DB together after the entire flow is finished successfully rather than after each execution.
This can be achieved by calling the services/APIs in a multiApi. The multiApi API is used to call multiple APIs from a single API invocation. It makes sure that data is committed to the DB only after all the executions are successful. This wrapper API ensures that all the APIs/services within a invocation reside in the same commitment boundary. This permits a set of work to be submitted as a unit; either all the work, as represented by the API calls, succeeds or fails. If any individual API throws an exception, the multiApi API throws an exception, and the work done so far is rolled back.