Class NarayanaLRAClient

java.lang.Object
io.narayana.lra.client.internal.NarayanaLRAClient
All Implemented Interfaces:
Closeable, AutoCloseable

@Deprecated @RequestScoped public class NarayanaLRAClient extends Object implements Closeable
Deprecated.
WARNING: NarayanaLRAClient is an internal utility class and is subject to change (however it will be made available with improved guarantees in a subsequent release).

A utility class for controlling the lifecycle of Long Running Actions (LRAs) but the preferred mechanism is to use the annotation in the

invalid reference
org.eclipse.microprofile.lra.annotation
package
  • Field Details

    • LRA_COORDINATOR_URL_KEY

      public static final String LRA_COORDINATOR_URL_KEY
      Deprecated.
      Key for looking up the config property that specifies which is the URL to connect to the Narayana LRA coordinator
      See Also:
  • Constructor Details

    • NarayanaLRAClient

      public NarayanaLRAClient()
      Deprecated.
      Creating LRA client. The URL of the LRA coordinator will be taken from system property LRA_COORDINATOR_URL_KEY. If not defined as default value is taken http://localhost:8080/lra-coordinator. The LRA recovery coordinator will be searched at the sub-path "recovery".
      Throws:
      IllegalStateException - thrown when the URL taken from the system property value is not a URL format
    • NarayanaLRAClient

      public NarayanaLRAClient(String protocol, String host, int port, String coordinatorPath)
      Deprecated.
      Creating LRA client where expecting LRA coordinator being available through protocol protocol at host:port/coordinatorPath.
      Parameters:
      protocol - protocol used to contact the LRA coordinator
      host - hostname where the LRA coordinator will be contacted
      port - port where the LRA coordinator will be contacted
      coordinatorPath - path where the LRA coordinator will be contacted
    • NarayanaLRAClient

      public NarayanaLRAClient(URI coordinatorUrl)
      Deprecated.
      Creating LRA client where expecting LRA coordinator being available at the provided uri. The LRA recovery coordinator will be searched at the sub-path "recovery".
      Parameters:
      coordinatorUrl - uri of the LRA coordinator
    • NarayanaLRAClient

      public NarayanaLRAClient(String coordinatorUrl)
      Deprecated.
      Creating LRA client where expecting LRA coordinator being available at the provided URL defined by String. The LRA recovery coordinator will be searched at the sub-path "recovery".
      Parameters:
      coordinatorUrl - url of the LRA coordinator
      Throws:
      IllegalStateException - thrown when the provided URL String is not a URL format
  • Method Details

    • setCurrentLRA

      public void setCurrentLRA(URI lraId)
      Deprecated.
      Method changes the client's notion about the place where the LRA coordinator can be contacted. It takes the provided URI and tries to derive the URL path of the coordinator responsible for the LRA id. The URL is then used as endpoint for later use of this LRA Narayana client instance.
      Parameters:
      lraId - LRA id consisting of the coordinator URL and the LRA uid
    • getAllLRAs

      public List<LRAData> getAllLRAs()
      Deprecated.
    • startLRA

      public URI startLRA(String clientID) throws jakarta.ws.rs.WebApplicationException
      Deprecated.
      Starting LRA. You provide client id determining the LRA being started.
      Parameters:
      clientID - client id determining the LRA
      Returns:
      LRA id as URL
      Throws:
      jakarta.ws.rs.WebApplicationException - thrown when start of the LRA failed
    • startLRA

      public URI startLRA(URI parentLRA, String clientID, Long timeout, ChronoUnit unit) throws jakarta.ws.rs.WebApplicationException
      Deprecated.
      Throws:
      jakarta.ws.rs.WebApplicationException
    • startLRA

      public URI startLRA(URI parentLRA, String clientID, Long timeout, ChronoUnit unit, boolean verbose) throws jakarta.ws.rs.WebApplicationException
      Deprecated.
      Starting LRA. You provide client id that joins the LRA context and is passed when working with the LRA.
      Parameters:
      parentLRA - when the newly started LRA should be nested with this LRA parent, when null the newly started LRA is top-level
      clientID - client id determining the LRA
      timeout - timeout value, when timeout-ed the LRA will be compensated
      unit - timeout unit, when null seconds are used
      Returns:
      LRA id as URL
      Throws:
      jakarta.ws.rs.WebApplicationException - thrown when start of the LRA failed
    • cancelLRA

      public void cancelLRA(URI lraId) throws jakarta.ws.rs.WebApplicationException
      Deprecated.
      Throws:
      jakarta.ws.rs.WebApplicationException
    • closeLRA

      public void closeLRA(URI lraId) throws jakarta.ws.rs.WebApplicationException
      Deprecated.
      Throws:
      jakarta.ws.rs.WebApplicationException
    • cancelLRA

      public void cancelLRA(URI lraId, String compensator, String userData) throws jakarta.ws.rs.WebApplicationException
      Deprecated.
      Throws:
      jakarta.ws.rs.WebApplicationException
    • closeLRA

      public void closeLRA(URI lraId, String compensator, String userData) throws jakarta.ws.rs.WebApplicationException
      Deprecated.
      Throws:
      jakarta.ws.rs.WebApplicationException
    • joinLRA

      public URI joinLRA(URI lraId, Long timeLimit, URI compensateUri, URI completeUri, URI forgetUri, URI leaveUri, URI afterUri, URI statusUri, String compensatorData) throws jakarta.ws.rs.WebApplicationException
      Deprecated.
      Joining the LRA with identity of `lraId` as participant defined by URIs for complete, compensate, forget, leave, after and status.
      Parameters:
      lraId - the URI of the LRA to join
      timeLimit - how long the participant is prepared to wait for LRA completion
      compensateUri - URI for compensation notifications
      completeUri - URI for completion notifications
      forgetUri - URI for forget callback
      leaveUri - URI for leave requests
      statusUri - URI for reporting the status of the participant
      compensatorData - data provided during compensation
      Returns:
      a recovery URL for this enlistment
      Throws:
      jakarta.ws.rs.WebApplicationException - if the LRA coordinator failed to enlist the participant
    • joinLRA

      public URI joinLRA(URI lraId, Long timeLimit, URI compensateUri, URI completeUri, URI forgetUri, URI leaveUri, URI afterUri, URI statusUri, StringBuilder compensatorData) throws jakarta.ws.rs.WebApplicationException
      Deprecated.
      Throws:
      jakarta.ws.rs.WebApplicationException
    • joinLRA

      public URI joinLRA(URI lraId, Long timeLimit, URI participantUri, StringBuilder compensatorData) throws jakarta.ws.rs.WebApplicationException
      Deprecated.
      Joining the LRA with identity of `lraId` as participant defined by a participant URI.
      Parameters:
      lraId - the URI of the LRA to join
      timeLimit - how long the participant is prepared to wait for LRA completion
      participantUri - URI of participant for enlistment
      compensatorData - data provided during compensation
      Returns:
      a recovery URL for this enlistment
      Throws:
      jakarta.ws.rs.WebApplicationException - if the LRA coordinator failed to enlist the participant
    • leaveLRA

      public void leaveLRA(URI lraId, String body) throws jakarta.ws.rs.WebApplicationException
      Deprecated.
      Throws:
      jakarta.ws.rs.WebApplicationException
    • getTerminationUris

      public static Map<String,String> getTerminationUris(Class<?> compensatorClass, String uriPrefix, Long timeout)
      Deprecated.
      For particular compensator class it returns termination uris based on the provided base uri. You get map of string and URI.
      Parameters:
      compensatorClass - compensator class to examine
      uriInfo - the uri that triggered this join request.
      Returns:
      map of URI
    • isAsyncCompletion

      public static boolean isAsyncCompletion(Method method)
      Deprecated.
      Providing information if method is defined to be completed asynchronously. This means that Suspended annotation is available amongst the method parameters while the method is annotated with Complete or Compensate.
      Parameters:
      method - method to be checked for async completion
      Returns:
      true if method is to complete asynchronously, false if synchronously
    • getStatus

      public org.eclipse.microprofile.lra.annotation.LRAStatus getStatus(URI uri) throws jakarta.ws.rs.WebApplicationException
      Deprecated.
      Throws:
      jakarta.ws.rs.WebApplicationException
    • enlistCompensator

      public URI enlistCompensator(URI uri, Long timelimit, String linkHeader, StringBuilder compensatorData)
      Deprecated.
    • getCoordinatorUrl

      public String getCoordinatorUrl()
      Deprecated.
    • getRecoveryUrl

      public String getRecoveryUrl()
      Deprecated.
    • getCurrent

      public URI getCurrent()
      Deprecated.
    • close

      public void close()
      Deprecated.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable