Interface ActivityInfo
public interface ActivityInfo
Information about the Activity Task that the current Activity Execution is handling. Use
ActivityExecutionContext.getInfo() to access.-
Method Summary
Modifier and TypeMethodDescriptionID of the Activity Execution.Deprecated.intGets the current Activity Execution attempt count.longTime when the Activity Task (current attempt) was scheduled by the Temporal Server.Optional<io.temporal.api.common.v1.Payloads> default NexusSerializationContextReturns the context of the Nexus operation handler that started this standalone activity, ornullif it wasn't started by one.Return the priority of the activity task.getRunId()Deprecated.longTime when the Activity Execution was initially scheduled by the Workflow Execution.longTime when the Activity Task (current attempt) was started.byte[]Deprecated.usegetNamespace()default booleanbooleanisLocal()Used to determine if the Activity Execution is a local Activity.
-
Method Details
-
getTaskToken
byte[] getTaskToken()- Returns:
- a correlation token that can be used to complete the Activity Execution asynchronously
through
ActivityCompletionClient.complete(byte[], Object).
-
getWorkflowId
- Returns:
- WorkflowId of the Workflow Execution that scheduled the Activity Execution, or
nullfor standalone activities not scheduled by a workflow.
-
getRunId
Deprecated.- Returns:
- RunId of the Workflow Execution that scheduled the Activity Execution, or
nullfor standalone activities not scheduled by a workflow.
-
getWorkflowRunId
- Returns:
- RunId of the Workflow Execution that scheduled the Activity Execution, or
nullfor standalone activities not scheduled by a workflow.
-
getActivityRunId
- Returns:
- the run ID of this standalone Activity Execution, or
nullfor activities scheduled by a workflow.
-
getActivityId
String getActivityId()ID of the Activity Execution. This ID can be used to complete the Activity Execution asynchronously throughActivityCompletionClient.complete(String, Optional, String, Object). -
getActivityType
String getActivityType()- Returns:
- type of the Activity.
-
getScheduledTimestamp
long getScheduledTimestamp()Time when the Activity Execution was initially scheduled by the Workflow Execution.- Returns:
- Timestamp in milliseconds (UNIX Epoch time)
-
getStartedTimestamp
long getStartedTimestamp()Time when the Activity Task (current attempt) was started.- Returns:
- Timestamp in milliseconds (UNIX Epoch time)
-
getCurrentAttemptScheduledTimestamp
long getCurrentAttemptScheduledTimestamp()Time when the Activity Task (current attempt) was scheduled by the Temporal Server.- Returns:
- Timestamp in milliseconds (UNIX Epoch time)
-
getScheduleToCloseTimeout
Duration getScheduleToCloseTimeout()- Returns:
- the Schedule-To-Close Timeout setting as a Duration.
-
getStartToCloseTimeout
Duration getStartToCloseTimeout()- Returns:
- the Start-To-Close Timeout setting as a Duration.
-
getHeartbeatTimeout
- Returns:
- the Heartbeat Timeout setting as a Duration.
Duration.ZEROif absent
-
getHeartbeatDetails
Optional<io.temporal.api.common.v1.Payloads> getHeartbeatDetails() -
getWorkflowType
- Returns:
- the Workflow Type of the Workflow Execution that executed the Activity, or
nullfor standalone activities not scheduled by a workflow.
-
getWorkflowNamespace
Deprecated.usegetNamespace()Note: At some moment Temporal had built-in support for scheduling activities on a different namespace than the original workflow. Currently, Workflows can schedule activities only on the same namespace, hence no need for differentgetWorkflowNamespace()andgetActivityNamespace()methods.- Returns:
- the Namespace of Workflow Execution that scheduled the Activity, or null for standalone activities.
-
getActivityNamespace
Deprecated.usegetNamespace()Note: At some moment Temporal had built-in support for scheduling activities on a different namespace than the original workflow. Currently, Workflows can schedule activities only on the same namespace, hence no need for differentgetWorkflowNamespace()andgetActivityNamespace()methods.- Returns:
- the Namespace of this Activity Execution.
-
getNamespace
String getNamespace()- Returns:
- the Namespace of this Activity Execution.
-
isInWorkflow
default boolean isInWorkflow()- Returns:
trueif this activity was scheduled by a workflow execution;falsefor standalone activities.
-
getActivityTaskQueue
String getActivityTaskQueue() -
getAttempt
int getAttempt()Gets the current Activity Execution attempt count. Attempt counts start at 1 and increment on each Activity Task Execution retry. -
isLocal
boolean isLocal()Used to determine if the Activity Execution is a local Activity. -
getPriority
Return the priority of the activity task.Note: If unset or on an older server version, this method will return
Priority.getDefaultInstance(). -
getRetryOptions
RetryOptions getRetryOptions()- Returns:
- Retry options for the Activity Execution.
-
getNexusSerializationContext
Returns the context of the Nexus operation handler that started this standalone activity, ornullif it wasn't started by one.To complete the activity asynchronously, store this context together with the
task tokenand pass it toActivityCompletionClient.withContext(NexusSerializationContext), so the result is encoded with the context the Nexus caller decodes it with.
-
getNamespace()