@ApplicationScoped @Path(value="lraresource-cancelon") public class LraCancelOnResource extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CANCEL_FROM_REMOTE_CALL |
static String |
CANCEL_ON_301 |
static String |
CANCEL_ON_FAMILY_3XX |
static String |
CANCEL_ON_FAMILY_DEFAULT_4XX |
static String |
CANCEL_ON_FAMILY_DEFAULT_5XX |
static String |
LRA_CANCEL_ON_RESOURCE_PATH |
static String |
NOT_CANCEL_ON_FAMILY_5XX |
Constructor and Description |
---|
LraCancelOnResource() |
Modifier and Type | Method and Description |
---|---|
jakarta.ws.rs.core.Response |
cancelFromRemoteCall(URI lraId,
jakarta.ws.rs.core.UriInfo uriInfo)
Returning
200 thus the LRA should be closed but beforehand it makes a remote REST call which returns
5xx which is the default for the cancelling and so the whole LRA should be cancelled. |
jakarta.ws.rs.core.Response |
cancelOn301(URI lraId)
Cancel on is set to
301 . |
jakarta.ws.rs.core.Response |
cancelOnFamily3xx(URI lraId)
Cancel on family is set to
3xx . |
jakarta.ws.rs.core.Response |
cancelOnFamilyDefault4xx(URI lraId)
Default return status for cancelling LRA is
4xx and 5xx |
jakarta.ws.rs.core.Response |
cancelOnFamilyDefault5xx(URI lraId)
Default return status for cancelling LRA is
4xx and 5xx |
jakarta.ws.rs.core.Response |
compensateWork(URI lraId) |
jakarta.ws.rs.core.Response |
completeWork(URI lraId) |
jakarta.ws.rs.core.Response |
notCancelOnFamily5xx(URI lraId)
Cancel on family is set to
4xx , the code from other families (e.g. |
public static final String LRA_CANCEL_ON_RESOURCE_PATH
public static final String CANCEL_ON_FAMILY_DEFAULT_4XX
public static final String CANCEL_ON_FAMILY_DEFAULT_5XX
public static final String CANCEL_ON_FAMILY_3XX
public static final String CANCEL_ON_301
public static final String NOT_CANCEL_ON_FAMILY_5XX
public static final String CANCEL_FROM_REMOTE_CALL
@GET @Path(value="cancelOnFamilyDefault4xx") public jakarta.ws.rs.core.Response cancelOnFamilyDefault4xx(@HeaderParam(value="Long-Running-Action") URI lraId)
4xx
and 5xx
lraId
- The LRA id generated for this action@GET @Path(value="cancelOnFamilyDefault5xx") public jakarta.ws.rs.core.Response cancelOnFamilyDefault5xx(@HeaderParam(value="Long-Running-Action") URI lraId)
4xx
and 5xx
lraId
- The LRA id generated for this action@GET @Path(value="cancelOnFamily3xx") public jakarta.ws.rs.core.Response cancelOnFamily3xx(@HeaderParam(value="Long-Running-Action") URI lraId)
3xx
. The 3xx
return code has to cancel the LRA.lraId
- The LRA id generated for this action@GET @Path(value="cancelOn301") public jakarta.ws.rs.core.Response cancelOn301(@HeaderParam(value="Long-Running-Action") URI lraId)
301
. The 301
return code has to cancel the LRA.lraId
- The LRA id generated for this action@GET @Path(value="notCancelOnFamily5xx") public jakarta.ws.rs.core.Response notCancelOnFamily5xx(@HeaderParam(value="Long-Running-Action") URI lraId)
4xx
, the code from other families (e.g. for 5xx
should not
cancel but should go with close the LRA.lraId
- The LRA id generated for this action@GET @Path(value="cancelFromRemoteCall") public jakarta.ws.rs.core.Response cancelFromRemoteCall(@HeaderParam(value="Long-Running-Action") URI lraId, @Context jakarta.ws.rs.core.UriInfo uriInfo)
Returning 200
thus the LRA should be closed but beforehand it makes a remote REST call which returns
5xx which is the default for the cancelling and so the whole LRA should be cancelled.
The remote REST call invokes the same resource class LraCancelOnResource
That assumes the call to the
representative of the same LRA participant as it's already enlisted by the method
cancelFromRemoteCall(java.net.URI, jakarta.ws.rs.core.UriInfo)
invoked by the test. Because the
specification mandates that the same participant can be enlisted only once per LRA instance then the
Compensate
method compensateWork(URI)
will be called only once for the test invocation.
lraId
- The LRA id generated for this actionuriInfo
- as context provided by JAX-RS to find base service URI@PUT @Path(value="/complete") public jakarta.ws.rs.core.Response completeWork(@HeaderParam(value="Long-Running-Action") URI lraId)
@PUT @Path(value="/compensate") public jakarta.ws.rs.core.Response compensateWork(@HeaderParam(value="Long-Running-Action") URI lraId)
Copyright © 2018 – 2021 Eclipse Foundation. All rights reserved.
Use is subject to license terms.