Skip to main content

Temporal Commands reference

View Markdown

A Command is an action a Worker requests from the Temporal Service when it completes a Workflow Task Execution. The SDK generates Commands from your Workflow code, such as a call to execute an Activity or start a Timer. The Temporal Service records an Event in the Event History for each Command.

Commands are defined in the CommandType enum and command messages of the Temporal gRPC API.

Each Command on this page lists the following:

  • Awaitable: Whether the Workflow can wait on the result of the Command.
  • Corresponding Event: The Event the Temporal Service records for the Command.
  • Limit: The default maximum number of pending operations of this type per Workflow Execution, if one applies. When a Workflow Execution reaches the limit, the Workflow Task fails and is retried. See Workflow Execution limits.

Workflow Execution close Commands​

Each of these Commands closes the Workflow Execution. Its corresponding Event is the last Event in the Event History.

CompleteWorkflowExecution​

The Worker issues this Command when the Workflow Function returns.

ContinueAsNewWorkflowExecution​

The Worker issues this Command when the Workflow calls Continue-As-New.

FailWorkflowExecution​

The Worker issues this Command when the Workflow returns an error or throws an exception that fails the Workflow Execution.

CancelWorkflowExecution​

The Worker issues this Command when the Workflow finishes cleaning up after a Cancellation Request. The request appears in the Event History as a WorkflowExecutionCancelRequested Event.

Activity Commands​

ScheduleActivityTask​

The Worker issues this Command when the Workflow calls an Activity.

RequestCancelActivityTask​

The Worker issues this Command when the Workflow requests cancellation of an Activity Task.

Timer Commands​

StartTimer​

The Worker issues this Command when the Workflow starts a Timer, such as a call to sleep.

CancelTimer​

The Worker issues this Command when the Workflow cancels a Timer.

Child and external Workflow Commands​

StartChildWorkflowExecution​

The Worker issues this Command when the Workflow starts a Child Workflow Execution.

SignalExternalWorkflowExecution​

The Worker issues this Command when the Workflow sends a Signal to another Workflow Execution.

RequestCancelExternalWorkflowExecution​

The Worker issues this Command when the Workflow requests cancellation of another Workflow Execution.

Nexus Commands​

ScheduleNexusOperation​

The Worker issues this Command when the caller Workflow executes a Nexus Operation.

RequestCancelNexusOperation​

The Worker issues this Command when the caller Workflow requests cancellation of a Nexus Operation.

Workflow metadata and SDK Commands​

RecordMarker​

The SDK issues this Command to record data it needs to replay the Workflow deterministically, such as the result of a Side Effect, a Local Activity, or a version check. Your Workflow code doesn't issue it directly.

UpsertWorkflowSearchAttributes​

The Worker issues this Command when the Workflow adds or updates its Search Attributes.

ModifyWorkflowProperties​

The Worker issues this Command when the Workflow adds or updates its Memo. The new values merge with the existing Memo.

  • Awaitable: No
  • Corresponding Event: WorkflowPropertiesModified

ProtocolMessage​

The Worker issues this Command to keep protocol messages, such as responses to Updates, in order with the Workflow's other Commands.

The Command points to a protocol message, and the Temporal Service creates the Event from that message. The Command alone doesn't determine the resulting Event type. For Updates, the Events are WorkflowExecutionUpdateAccepted and WorkflowExecutionUpdateCompleted.