Skip to content

Instantly share code, notes, and snippets.

@xstefank
Created November 15, 2019 07:09
Show Gist options
  • Save xstefank/f5cc9c906676bb7dd451fb2fd9acdc6a to your computer and use it in GitHub Desktop.
Save xstefank/f5cc9c906676bb7dd451fb2fd9acdc6a to your computer and use it in GitHub Desktop.
@Path("reused-participant")
public class ReusedParticipant2 {
@GET
@Path("reused-endpoint")
// no LRA annotation!
public Object reusedEndpoint(@HeaderParam("flow-type") String flowType) {
if (flowType.equals("first-flow")) {
selfRestInvoke("first-flow");
} else if (flowType.equals("second-flow")) {
selfRestInvoke("second-flow");
}
}
@GET
@Path("first-flow")
@LRA(LRA.Type.MANDATORY)
public Object firstFlow(@HeaderParam(LRA_HTTP_CONTEXT_HEADER) URI lraId) {
// ...
}
@GET
@Path("second-flow")
@LRA(value = LRA.Type.REQUIRES_NEW, end = false)
public Object secondFlow(@HeaderParam(LRA_HTTP_CONTEXT_HEADER) URI lraId) {
// ...
}
// reuse callbacks
@PUT
@Path("compensate")
@Compensate
public Response compensate() {
// ...
}
@PUT
@Path("complete")
@Complete
public Response complete() {
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment