You can perform the following steps to implement the booking order distributed transaction using sagas:
- First, we'll add the saga-lib dependency in the pom.xml file of booking-service as follows:
<dependency> <groupId>com.codebullets.saga-lib</groupId> <artifactId>saga-lib</artifactId> <version>3.2.0</version></dependency>
This provides basic saga features, such as distributed saga start/stop and the compensating transaction calls required for the implementation of sagas .
- Next, we'll add the input cloud, stream, and binding to application.yml to receive the billing response, as shown in bold:
spring: cloud: stream: bindings: bookingOrderOutput: destination: amp.bookingOrdered contentType: application/*+avro billingInput: ...