Class OperationTokenUtil

java.lang.Object
io.temporal.internal.nexus.OperationTokenUtil

public class OperationTokenUtil extends Object
  • Method Details

    • loadOperationToken

      public static OperationToken loadOperationToken(String operationToken)
      Load and validate an operation token without asserting the token type. Use this for cancel dispatch where the token type determines the cancel behavior.
      Throws:
      IllegalArgumentException - if the operation token is malformed or has invalid structure
    • loadWorkflowRunOperationToken

      public static OperationToken loadWorkflowRunOperationToken(String operationToken)
      Load a workflow run operation token, asserting that the token type is OperationTokenType.WORKFLOW_RUN.
      Throws:
      IllegalArgumentException - if the operation token is invalid or not a workflow run token
    • loadWorkflowUpdateOperationToken

      public static OperationToken loadWorkflowUpdateOperationToken(String operationToken)
      Load a workflow update operation token, asserting that the token type is OperationTokenType.WORKFLOW_UPDATE.
      Throws:
      IllegalArgumentException - if the operation token is invalid or not a workflow update token
    • loadWorkflowIdFromOperationToken

      public static String loadWorkflowIdFromOperationToken(String operationToken)
      Extract the workflow ID from a workflow run operation token.
      Throws:
      IllegalArgumentException - if the operation token is invalid
    • loadActivityExecutionOperationToken

      public static OperationToken loadActivityExecutionOperationToken(String operationToken)
      Load an activity execution operation token, asserting that the token type is OperationTokenType.ACTIVITY_EXECUTION.
      Throws:
      IllegalArgumentException - if the operation token is invalid or not an activity execution token
    • loadActivityIdFromOperationToken

      public static String loadActivityIdFromOperationToken(String operationToken)
      Extract the activity ID from an activity execution operation token.
      Throws:
      IllegalArgumentException - if the operation token is invalid
    • generateWorkflowRunOperationToken

      public static String generateWorkflowRunOperationToken(String workflowId, String namespace) throws com.fasterxml.jackson.core.JsonProcessingException
      Generate a workflow run operation token from a workflow ID and namespace.
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • generateWorkflowUpdateOperationToken

      public static String generateWorkflowUpdateOperationToken(String namespace, String workflowId, String runId, String updateId) throws com.fasterxml.jackson.core.JsonProcessingException
      Generate a workflow update operation token from namespace, workflowId, runId, updateId
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • generateActivityExecutionOperationToken

      public static String generateActivityExecutionOperationToken(String activityId, String namespace) throws com.fasterxml.jackson.core.JsonProcessingException
      Generate an activity execution operation token from an activity ID and namespace.

      This overload omits the run ID. Use it when writing the token into the Nexus operation-token callback header — that token is generated before the start RPC completes, so the run ID is not yet known.

      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • generateActivityExecutionOperationToken

      public static String generateActivityExecutionOperationToken(String activityId, String runId, String namespace) throws com.fasterxml.jackson.core.JsonProcessingException
      Generate an activity execution operation token from an activity ID, run ID, and namespace. The runId is included only when non-null.

      This overload is used for the operation token returned to the Nexus caller from a start operation — at that point the start RPC has completed and the run ID is known. The header token written into the activity completion callback must NOT carry a run ID; use generateActivityExecutionOperationToken(String, String) for that path.

      Throws:
      com.fasterxml.jackson.core.JsonProcessingException