Package org.eclipse.microprofile.lra.annotation

# Annotation Type Forget

@Retention(RUNTIME) @Target(METHOD) public @interface Forget

If a participant is unable to complete or compensate immediately (i.e., it has indicated that the request has been accepted and is in progress) or because of a failure (i.e., will never be able to finish) then it must remember the fact (by reporting it when asked for its `Status`) until explicitly told that it can clean up using this `@Forget` annotation.

Similar remarks apply if the participant was enlisted in a nested LRA (`LRA.Type.NESTED`). Actions performed in the context of a nested LRA must remain compensatable until the participant is explicitly told it can clean up using this `@Forget` annotation.

If the annotation is applied to a JAX-RS resource method then the request method MUST be `DELETE`. The context of the currently running LRA can be obtained by inspecting the incoming JAX-RS headers. If this LRA is nested then the parent LRA MUST be present in the header with the name `LRA.LRA_HTTP_PARENT_CONTEXT_HEADER` and value is of type `URI`.

If the annotated method is not a JAX-RS resource method, the context of the currently running LRA can be obtained by adhering to a predefined method signature as defined in the LRA specification document. Similarly the method may determine whether or not it runs with a nested LRA by providing a parameter to hold the parent context. For example,

              @Forget
              public void forget(URI lraId, URI parentId) { ...}

would be a valid forget method declaration. If an invalid signature is detected the implementation of this specification MUST prohibit successful startup of the application (e.g. with a runtime exception).

Since the participant generally needs to know the id of the LRA in order to clean up there is generally no benefit to combining this annotation with the `LRA` annotation (though it is not prohibited).

Related information is provided in the javadoc for the `Status`.

If the method is a JAX-RS resource method (or is a non JAX-RS method annotated with `@Forget` with return type `jakarta.ws.rs.core.Response`) then the following are the only valid response codes:

JAX-RS Response Codes For Forget Methods
Code | Response Body | Meaning
--- | --- | ---
200 | Empty | The participant may have removed all knowledge of the LRA
410 | Empty | The method does not know about the LRA

If any other code is returned then the implementation SHOULD keep retrying. If it stops retrying, a warning message SHOULD be logged.