View StartLRAExampleAppServices
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 |
View RegisterClientLRA.java
public OrderResource() { | |
client = ClientBuilder.newBuilder() | |
.register(ClientLRARequestFilter.class) | |
.register(ClientLRAResponseFilter.class) | |
.build(); | |
} |
View lraparticipantdependencies.pom
<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> |
View LRAFilterRegistrationDynamicFeature.java
@Override | |
public Set<Class<?>> getClasses() { | |
Set<Class<?>> s = new HashSet<Class<?>>(); | |
s.add(FilterRegistration.class); | |
//... | |
return s; | |
} |
View lra-compensationrun-steps.sh
curl http://localhost:8091/inventory/removeInventory | |
curl http://localhost:8090/order/placeOrder |
View lra-successrun-steps.sh
curl http://localhost:8091/inventory/addInventory | |
curl http://localhost:8090/order/placeOrder |
View lra-coordinator.pom
<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> |
View InventoryResource.java
@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(); | |
} |
View lraparticipantannotationchecker.pom
<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> |
View OrderResource.java
@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") |