Skip to content

Instantly share code, notes, and snippets.

@rdebusscher
Last active April 2, 2019 08:23
Show Gist options
  • Save rdebusscher/ad914ba528dbe638f926e6bf2fdbd3e9 to your computer and use it in GitHub Desktop.
Save rdebusscher/ad914ba528dbe638f926e6bf2fdbd3e9 to your computer and use it in GitHub Desktop.
MicroProfile LRA Participant recovery scenario
Example has 3 components
- A client application which can be anything. It calls 2 endpoints to process a User action.
- The client application retrieves the actual URLs of the endpoint from a service discocvery component just before calling them as they can be located at any URL.
- A service A which is the first step in the transaction
- A service B which is the second step.
What happens when the ServiceB cancels the LRA but service A is crashed at that moment and restored at a different URL.
How is the cancelStepA() called eventually?
----
@Path("/serviceA")
public class serviceA {
@POST
@LRA(end = false)
public Response doStepA(....) {
}
@Compensate
public Response cancelStepA(@HeaderParam(LRA_HTTP_HEADER) String lraId) {
}
@Recover
public Response participantHasMoved(
@HeaderParam(LRA_HTTP_RECOVERY_HEADER) String recoveryId) {...}
}
@Path("/serviceB")
@LRA
public class serviceB {
@POST
public Response doStepB(....) {
}
}
----
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment