Class OperationTokenUtil
java.lang.Object
io.temporal.internal.nexus.OperationTokenUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringgenerateActivityExecutionOperationToken(String activityId, String namespace) Generate an activity execution operation token from an activity ID and namespace.static StringgenerateActivityExecutionOperationToken(String activityId, String runId, String namespace) Generate an activity execution operation token from an activity ID, run ID, and namespace.static StringgenerateWorkflowRunOperationToken(String workflowId, String namespace) Generate a workflow run operation token from a workflow ID and namespace.static StringgenerateWorkflowUpdateOperationToken(String namespace, String workflowId, String runId, String updateId) Generate a workflow update operation token from namespace, workflowId, runId, updateIdstatic OperationTokenloadActivityExecutionOperationToken(String operationToken) Load an activity execution operation token, asserting that the token type isOperationTokenType.ACTIVITY_EXECUTION.static StringloadActivityIdFromOperationToken(String operationToken) Extract the activity ID from an activity execution operation token.static OperationTokenloadOperationToken(String operationToken) Load and validate an operation token without asserting the token type.static StringloadWorkflowIdFromOperationToken(String operationToken) Extract the workflow ID from a workflow run operation token.static OperationTokenloadWorkflowRunOperationToken(String operationToken) Load a workflow run operation token, asserting that the token type isOperationTokenType.WORKFLOW_RUN.static OperationTokenloadWorkflowUpdateOperationToken(String operationToken) Load a workflow update operation token, asserting that the token type isOperationTokenType.WORKFLOW_UPDATE.
-
Method Details
-
loadOperationToken
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
Load a workflow run operation token, asserting that the token type isOperationTokenType.WORKFLOW_RUN.- Throws:
IllegalArgumentException- if the operation token is invalid or not a workflow run token
-
loadWorkflowUpdateOperationToken
Load a workflow update operation token, asserting that the token type isOperationTokenType.WORKFLOW_UPDATE.- Throws:
IllegalArgumentException- if the operation token is invalid or not a workflow update token
-
loadWorkflowIdFromOperationToken
Extract the workflow ID from a workflow run operation token.- Throws:
IllegalArgumentException- if the operation token is invalid
-
loadActivityExecutionOperationToken
Load an activity execution operation token, asserting that the token type isOperationTokenType.ACTIVITY_EXECUTION.- Throws:
IllegalArgumentException- if the operation token is invalid or not an activity execution token
-
loadActivityIdFromOperationToken
Extract the activity ID from an activity execution operation token.- Throws:
IllegalArgumentException- if the operation token is invalid
-
generateWorkflowRunOperationToken
-
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. TherunIdis 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
-