Distributed Transaction, Saga Pattern, Axon Framework, Spring Boot, Microservices.
public void onCompletePaymentEvent(CompletePaymentEvent event){ try { //SIMULATE A PAYMENT GATEWAY ERROR IF USER ID IS RWE0003 if(event.getUserId().equalsIgnoreCase("RWE0003")) { throw new Exception("Error"); } //Otherwise carry on with distributed transaction Payment payment =