This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Participant(name = "Airline") | |
/* @Participant declares the participant’s name to the saga framework */ | |
public class Airline extends SagaParticipant { | |
/* Airline extends the SagaParticipant class */ | |
@Request(sender = "TravelAgency") | |
/* The @Request annotates the method that handles incoming request from a given | |
sender, in this example the TravelAgency */ | |
public String handleTravelAgencyRequest(SagaMessageContext | |
info) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Participant(name = "TravelAgency") | |
/* @Participant declares the participant’s name to the saga framework */ | |
public class TravelAgencyController extends SagaInitiator { | |
/* TravelAgencyController extends the SagaInitiator class */ | |
@LRA(end = false) | |
/* @LRA annotates the method that begins a saga and invites participants */ | |
@POST("booking") | |
@Consumes(MediaType.TEXT_PLAIN) | |
@Produces(MediaType.APPLICATION_JSON) | |
public jakarta.ws.rs.core.Response booking( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java -jar lra-coordinator-helidon/target/lra-coordinator-helidon-0.0.1-SNAPSHOT.jar | |
java -jar order/target/order-0.0.1-SNAPSHOT.jar | |
java -jar inventory/target/inventory-0.0.1-SNAPSHOT.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl http://localhost:8091/inventory/removeInventory | |
curl http://localhost:8090/order/placeOrder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl http://localhost:8091/inventory/addInventory | |
curl http://localhost:8090/order/placeOrder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Path("/reserveInventoryForOrder") | |
@GET | |
@Produces(MediaType.APPLICATION_JSON) | |
@LRA(value = LRA.Type.MANDATORY, end = false) | |
public Response reserveInventoryForOrder(@HeaderParam(LRA_HTTP_CONTEXT_HEADER) String lraId) { | |
//... | |
if(inventoryExists) return Response.ok().entity("inventorysuccess").build(); | |
else return Response.ok().entity("inventoryfailure").build(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>org.jboss.narayana.rts</groupId> | |
<artifactId>lra-coordinator</artifactId> | |
<version>${narayana.lra.version}</version> | |
<type>war</type> | |
<scope>runtime</scope> | |
</dependency> | |
<dependency> | |
<groupId>org.jboss.narayana.rts</groupId> | |
<artifactId>lra-service-base</artifactId> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Path("/placeOrder") | |
@GET | |
@Produces(MediaType.APPLICATION_JSON) | |
@LRA(value = LRA.Type.REQUIRES_NEW) | |
public Response placeOrder(@HeaderParam(LRA_HTTP_CONTEXT_HEADER) String lraId) { | |
//... | |
} | |
@Path("/cancelOrder") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>org.eclipse.microprofile.lra</groupId> | |
<artifactId>microprofile-lra-api</artifactId> | |
<version>1.0-RC1</version> | |
<scope>compile</scope> | |
</dependency> | |
<dependency> | |
<groupId>org.jboss.narayana.rts</groupId> | |
<artifactId>lra-client</artifactId> | |
<version>${narayana.lra.version}</version> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<plugin> | |
<groupId>org.jboss.narayana.rts</groupId> | |
<artifactId>lra-annotation-checker-maven-plugin</artifactId> | |
<version>${narayana.lra.version}</version> | |
<executions> | |
<execution> | |
<goals> | |
<goal>check</goal> | |
</goals> | |
</execution> |
NewerOlder