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
public OrderResource() { | |
client = ClientBuilder.newBuilder() | |
.register(ClientLRARequestFilter.class) | |
.register(ClientLRAResponseFilter.class) | |
.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
@Override | |
public Set<Class<?>> getClasses() { | |
Set<Class<?>> s = new HashSet<Class<?>>(); | |
s.add(FilterRegistration.class); | |
//... | |
return s; | |
} |
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> |
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
@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.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("/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
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
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
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 |
OlderNewer