Class ManagedSagaClient

java.lang.Object
org.j7m.middleware.application.distributed.ManagedSagaClient

public final class ManagedSagaClient extends Object
Resource-injectable saga control facade for one host-registered definition and version. Administrative methods exist only when the host explicitly granted a separate server capability. Transport failure never proves nonexecution; retry an identical stable request and business input.
  • Method Details

    • start

      public ManagedSagaClient.Status start(String request, String sagaId, Object input, Instant deadline) throws IOException
      Starts an ordinary typed input with a stable native request and run identity. Encoding uses the exact generated first-step data type, never a class name from input.
      Parameters:
      request - stable application operation identity
      sagaId - stable logical run identity
      input - first step's declared data value
      deadline - absolute original deadline
      Returns:
      persisted native state; a timeout is not success
      Throws:
      IOException - on unavailable quorum or uncertain completion
      org.j7m.middleware.api.MiddlewareException - for closed/unavailable binding
      IllegalArgumentException - for invalid identity, schema or frame bounds
    • status

      public ManagedSagaClient.Status status(String sagaId, Instant deadline) throws IOException
      Reads actual durable state without granting run ownership.
      Parameters:
      sagaId - logical run identity
      deadline - absolute deadline
      Returns:
      exact persisted status or NOT_FOUND
      Throws:
      IOException - on unavailable quorum
      org.j7m.middleware.api.MiddlewareException - for an unavailable binding
    • result

      public <T> T result(String sagaId, Class<T> type, Instant deadline) throws IOException
      Decodes a completed result with the exact final step schema.
      Type Parameters:
      T - expected result type
      Parameters:
      sagaId - logical run identity
      type - exact final step result class or its corresponding boxed primitive token
      deadline - absolute deadline
      Returns:
      completed application result, possibly null
      Throws:
      IOException - on unavailable quorum
      org.j7m.middleware.api.MiddlewareException - while the run is not completed
      IllegalArgumentException - for a different requested type
    • requestCompensation

      public ManagedSagaClient.Status requestCompensation(String request, String sagaId, long expectedVersion, Instant deadline) throws IOException
      Requests a durable compensation decision using a separately granted administrative capability.
      Parameters:
      request - stable administrative request
      sagaId - logical run identity
      expectedVersion - exact observed run version
      deadline - absolute deadline
      Returns:
      persisted compensation decision or CONFLICT
      Throws:
      IOException - on unavailable quorum or uncertain completion
      org.j7m.middleware.api.MiddlewareException - without an explicit administrative registration
    • toString

      public String toString()
      Omits capabilities and program identities from diagnostics.
      Overrides:
      toString in class Object
      Returns:
      fixed safe label