Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions docs/encyclopedia/activities/activities.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: activities
title: What is a Temporal Activity?
sidebar_label: Activities
description:
Understand Temporal Activities, including Activity Definitions, Types, Executions, idempotency, cancellations, and
Understand Temporal Activities, including Activity Definitions, Types, Executions, idempotency, cancellations, Standalone Activities, and
Local Activities.
slug: /activities
toc_max_heading_level: 4
Expand All @@ -19,7 +19,7 @@ tags:

This guide provides a comprehensive overview of Temporal Activities including
[Activity Definition](/activity-definition), [Activity Type](/activity-definition#activity-type),
[Activity Execution](/activity-execution), and [Local Activity](/local-activity).
[Activity Execution](/activity-execution), [Standalone Activity](/standalone-activity), and [Local Activity](/local-activity).

An Activity is a normal function or method that executes a single, well-defined action (either short or long running),
such as calling another service, transcoding a media file, or sending an email message. Activity code can be
Expand All @@ -34,11 +34,14 @@ Activities are the most common Temporal primitive and encompass small units of w

Larger pieces of functionality should be broken up into multiple activities. This makes it easier to do failure recovery, have short timeouts, and be idempotent.

Workflow code orchestrates the execution of Activities, persisting the results. If an Activity Function Execution fails,
any future execution starts from initial state (except
[Heartbeats](/encyclopedia/detecting-activity-failures#activity-heartbeat)).
Workflow code orchestrates the execution of Activities, persisting the results. If an Activity Execution fails,
any future attempt will start from the initial state, unless your code uses ([Heartbeat details payloads](/encyclopedia/detecting-activity-failures#activity-heartbeat))
for checkpointing (storing state on the server, and using it when resuming subsequent attempts).

Activity Functions are executed by Worker Processes. When the Activity Function returns, the Worker sends the results
back to the Temporal Service as part of the [ActivityTaskCompleted](/references/events#activitytaskcompleted) Event. The
Event is added to the Workflow Execution's Event History. For other Activity-related Events, see
[Activity Events](/workflow-execution/event#activity-events).

If you only want to execute one Activity Function, then you don't need to use a Workflow: you can
use your SDK Client to invoke it directly as a [Standalone Activity](/standalone-activity).
5 changes: 3 additions & 2 deletions docs/encyclopedia/activities/activity-execution.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ You can customize [Activity Execution timeouts](/encyclopedia/detecting-activity
[retry policies](/encyclopedia/retry-policies).

If an Activity Execution fails (because it exhausted all retries, threw a
[non-retryable error](/encyclopedia/retry-policies#non-retryable-errors), or was canceled), the error is returned to the
[Workflow](/workflows), which decides how to handle it.
[non-retryable error](/encyclopedia/retry-policies#non-retryable-errors), or was canceled), the error is returned to your
[Workflow](/workflows) code when it attempts to fetch the Activity result. For [Standalone Activities](/standalone-activity) the error is
returned to the Client when you attempt to fetch the Activity result.

:::note

Expand Down
30 changes: 30 additions & 0 deletions docs/encyclopedia/activities/standalone-activity.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
id: standalone-activity
title: Standalone Activity
sidebar_label: Standalone Activity
description: Learn about Standalone Activities in Temporal, their benefits, execution model, and when to use them.
slug: /standalone-activity
toc_max_heading_level: 4
keywords:
- explanation
- term
- timeouts
tags:
- Concepts
- Activities
- Durable Execution
---

## Standalone Activity {#standalone-activity}

An [Activity Execution](/activity-execution) that is started directly by a [Client](/encyclopedia/temporal-sdks#temporal-client), without using a Workflow, is called a Standalone Activity.

If you need to orchestrate multiple Activity Executions, then you should use a Workflow. But if you
just need to execute a single Activity, then you can use a Standalone Activity. This will result in
fewer [Billable Actions](/cloud/actions#actions-in-workflows) in Temporal Cloud. If your Activity
Execution is short-lived, then you will also notice lower latency, since there are fewer worker
round-trips than when executing the Activity in a Workflow.

Standalone Activities support the same retry policies and timeouts as Workflow Activities, and you
write your Activity Functions in the same way for both. In fact, an Activity Function can be
executed both as a Standalone Activity and as a Workflow Activity.
2 changes: 1 addition & 1 deletion docs/encyclopedia/detecting-activity-failures.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ Activity Heartbeats are implemented within the Activity Definition.
Custom progress information can be included in the Heartbeat which can then be used by the Activity Execution should a retry occur.

An Activity Heartbeat can be recorded as often as needed (e.g. once a minute or every loop iteration).
It is often a good practice to Heartbeat on anything but the shortest Activity Function Execution.
It is often a good practice to Heartbeat on anything but the shortest Activity Execution.
Temporal SDKs control the rate at which Heartbeats are sent to the Temporal Service.

Heartbeating is not required from [Local Activities](/local-activity), and does nothing.
Expand Down
1 change: 1 addition & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,7 @@ module.exports = {
items: [
'encyclopedia/activities/activity-definition',
'encyclopedia/activities/activity-execution',
'encyclopedia/activities/standalone-activity',
'encyclopedia/activities/local-activity',
],
},
Expand Down