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
51 changes: 51 additions & 0 deletions docs/evaluate/development-production-features/job-queue.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
id: job-queue
title: Job Queue
sidebar_label: Job Queue
description: Standalone Activities adds the ability to execute any Temporal Activity as a top-level primitive without the full overhead of a Workflow.
keywords:
- job queue
- standalone activities
- background jobs
- durable execution
tags:
- Features
- Standalone Activities
---

## What is a Job Queue in Temporal?

A job is a single, discrete unit of work that runs asynchronously in the background such as sending an email, processing a webhook, syncing data, or executing a long-running task.

A job queue is the system that manages these jobs: accepting work, dispatching it to workers, retrying on failure, and providing visibility into what's running and what failed.

**Standalone Activities are Temporal's job queue.**

They let you use Temporal Activities as background jobs, in addition to using the same Activities as steps inside a Workflow. You write an Activity once and can run it either as a background job or as part of a multi-step Workflow.

Temporal provides stronger guarantees, better visibility, and more control than traditional job queues - while remaining cost-effective for high-volume use cases and offering a clean upgrade path to multi-step workflow orchestration.

### Overview

Standalone Activities add the ability to execute any Temporal Activity as a top-level Activity Execution for durable job processing.

#### Unified programming model & worker deployment

- Write an Activity once and use it anywhere - with a unified Activity programming model
- Optional heartbeats support checkpointing for long-running jobs
- Deploy to an Activity Worker once, and invoke standalone or from within a Workflow

#### Execution lifecycle

- Jobs are submitted as Standalone Activity Executions
- Each job is durably persisted with Temporal reliability, so jobs are not lost
- Jobs are scheduled with priority, fairness, deduplication and no head of line blocking
- Workers poll task queues and execute Activities (you run your own Workers)
- Temporal ensures retries, timeouts, and exponential backoff policy is enforced

#### Observability & lifecycle controls

- Full job visibility (list, search) with detailed execution state, retry count, errors & results
- OpenMetrics support
- Lifecycle controls: cancel, pause, unpause, reset, terminate
- Manual completion for external integrations & on-call management
2 changes: 2 additions & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports = {
},
items: [
'evaluate/development-production-features/core-application',
'evaluate/development-production-features/job-queue',
'evaluate/development-production-features/failure-detection',
'evaluate/development-production-features/throughput-composability',
'evaluate/development-production-features/nexus',
Expand Down Expand Up @@ -704,6 +705,7 @@ module.exports = {
items: [
'encyclopedia/activities/activity-definition',
'encyclopedia/activities/activity-execution',
'encyclopedia/activities/standalone-activity',
'encyclopedia/activities/local-activity',
],
},
Expand Down