Transactions, Spring.
private TransactionTemplate template; public void completeOrder(OrderRequest request) { template.execute( status -> { generateOrder(request); // DB call generateInvoice(request); // DB call return request; }); paymentApi(request); // external API calltemplate.execute( status -> {