Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
LRA participant: inventory service
@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();
}
@Path("/completeOrder")
@PUT
@Produces(MediaType.APPLICATION_JSON)
@Complete
public Response completeOrder(@HeaderParam(LRA_HTTP_CONTEXT_HEADER) String lraId) throws NotFoundException {
//...
}
@Path("/cancelOrder")
@PUT
@Produces(MediaType.APPLICATION_JSON)
@Compensate
public Response cancelOrder(@HeaderParam(LRA_HTTP_CONTEXT_HEADER) String lraId) throws NotFoundException {
//...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment