Last active
October 10, 2019 13:34
-
-
Save xstefank/2ef3de42462043e419d2d664af43b023 to your computer and use it in GitHub Desktop.
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
package io.xstefank; | |
import org.eclipse.microprofile.lra.annotation.Compensate; | |
import org.eclipse.microprofile.lra.annotation.Complete; | |
import org.eclipse.microprofile.lra.annotation.ws.rs.LRA; | |
import javax.ws.rs.GET; | |
import javax.ws.rs.HeaderParam; | |
import javax.ws.rs.PUT; | |
import javax.ws.rs.Path; | |
import javax.ws.rs.core.Response; | |
import java.net.URI; | |
@Path("/lra") | |
public class LraResource { | |
@GET | |
@Path("perform") | |
@LRA(value = LRA.Type.REQUIRED) | |
public Response perform(@HeaderParam(LRA.LRA_HTTP_CONTEXT_HEADER) URI lraId) { | |
System.out.println("PERFORM LRA " + lraId); | |
return Response.ok().build(); | |
} | |
@PUT | |
@Path("compensate") | |
@Compensate | |
public Response compensate(@HeaderParam(LRA.LRA_HTTP_CONTEXT_HEADER) URI lraId) { | |
System.out.println("COMPENSATE LRA " + lraId); | |
return Response.ok().build(); | |
} | |
@PUT | |
@Path("complete") | |
@Complete | |
public Response complete(@HeaderParam(LRA.LRA_HTTP_CONTEXT_HEADER) URI lraId) { | |
System.out.println("COMPLETE LRA " + lraId); | |
return Response.ok().build(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment