Interface ActivityInfo


public interface ActivityInfo
Information about the Activity Task that the current Activity Execution is handling. Use ActivityExecutionContext.getInfo() to access.
  • 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

      @Nullable String getWorkflowId()
      Returns:
      WorkflowId of the Workflow Execution that scheduled the Activity Execution, or null for standalone activities not scheduled by a workflow.
    • getRunId

      @Deprecated @Nullable String getRunId()
      Deprecated.
      Returns:
      RunId of the Workflow Execution that scheduled the Activity Execution, or null for standalone activities not scheduled by a workflow.
    • getWorkflowRunId

      @Nullable String getWorkflowRunId()
      Returns:
      RunId of the Workflow Execution that scheduled the Activity Execution, or null for standalone activities not scheduled by a workflow.
    • getActivityRunId

      @Nullable String getActivityRunId()
      Returns:
      the run ID of this standalone Activity Execution, or null for activities scheduled by a workflow.
    • getActivityId

      String getActivityId()
      ID of the Activity Execution. This ID can be used to complete the Activity Execution asynchronously through ActivityCompletionClient.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

      @Nonnull Duration getHeartbeatTimeout()
      Returns:
      the Heartbeat Timeout setting as a Duration. Duration.ZERO if absent
    • getHeartbeatDetails

      Optional<io.temporal.api.common.v1.Payloads> getHeartbeatDetails()
    • getWorkflowType

      @Nullable String getWorkflowType()
      Returns:
      the Workflow Type of the Workflow Execution that executed the Activity, or null for standalone activities not scheduled by a workflow.
    • getWorkflowNamespace

      @Deprecated @Nullable String getWorkflowNamespace()
      Deprecated.
      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 different getWorkflowNamespace() and getActivityNamespace() methods.
      Returns:
      the Namespace of Workflow Execution that scheduled the Activity, or null for standalone activities.
    • getActivityNamespace

      @Deprecated String getActivityNamespace()
      Deprecated.
      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 different getWorkflowNamespace() and getActivityNamespace() methods.
      Returns:
      the Namespace of this Activity Execution.
    • getNamespace

      String getNamespace()
      Returns:
      the Namespace of this Activity Execution.
    • isInWorkflow

      default boolean isInWorkflow()
      Returns:
      true if this activity was scheduled by a workflow execution; false for 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

      @Nonnull Priority 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

      @Experimental @Nullable default NexusSerializationContext getNexusSerializationContext()
      Returns the context of the Nexus operation handler that started this standalone activity, or null if it wasn't started by one.

      To complete the activity asynchronously, store this context together with the task token and pass it to ActivityCompletionClient.withContext(NexusSerializationContext), so the result is encoded with the context the Nexus caller decodes it with.