Temporal capabilities
Temporal delivers new development primitives that help simplify your code and allow you to build more features, faster. And at runtime, it's fault-tolerant and easily scalable so your apps can grow bigger, more reliably.
Autosave for Application State
Stop building state machines
Temporal captures the complete state of your functions (variables, threads, blocking calls) so you get the benefits of a state machine, without maintaining complex state machine code.
async function transfer(
fromAccount: string,
toAccount: string,
amount: number,
) {
// These are activities, not regular functions.
// Activities may run elsewhere, and their return value
// is automatically persisted by Temporal.
await myActivities.withdraw(fromAccount, amount);
try {
await myActivities.deposit(toAccount, amount);
} catch {
await myActivities.deposit(fromAccount, amount);
}
}
Native Retries
Set retry policies, don't code them
Temporal allows you to define exponential retry policies for Activities, so you don’t have to write retry logic into your application code. And your retry duration can be as long as needed, even months.
@activity.defn
async def compose_greeting(input: ComposeGreetingInput) -> str:
print(f"Invoking activity, attempt number {activity.info().attempt}")
# Fail the first 3 attempts, succeed the 4th
if activity.info().attempt < 4:
raise RuntimeError("Intentional failure" )
return f"{input.greeting}, {input.name}!"
@workflow.defn
class GreetingWorkflow:
@workflow.run
async def run(self, name: str) -> str:
# By default activities will retry, backing off an initial interval and
# then using a coefficient of 2 to increase the backoff each time after
# for an unlimited amount of time and an unlimited number of attempts.
# We'll keep those defaults except we'll set the maximum interval to
# just 2 seconds.
return await workflow.execute_activity(
compose_greeting,
ComposeGreetingInput("Hello", name),
start_to_close_timeout =timedelta(seconds=10),
retry_policy=RetryPolicy(maximum_interval=timedelta(seconds=2)),
)
Timeouts/Timers
Wait for 3 seconds or 3 months
Set timers to wait for days, weeks, or months, knowing that an outage or server restart during the wait period won’t prevent your workflow from executing.
import { proxyActivities, sleep } from "@temporalio/workflow";
import type { Activities } from "./activities";
const { hasUpgraded, sendReminderEmail } = proxyActivities<Activities>({
startToCloseTimeout: "10 seconds",
});
async function startTrial(user: string) {
while (!(await hasUpgraded(user))) {
await sendReminderEmail(user);
await sleep("30 days");
}
}
Schedules
Schedule, don't Cron
Temporal delivers an ability to schedule a workflow (much like a cron job) and then pause, re-start, and stop them as needed.
await new Client().schedule.create({
action: {
type: "startWorkflow",
workflowType: reminderWorkflow,
args: [
"♻️ Dear future self, please take out the recycling tonight. Sincerely, past you ❤️",
],
taskQueue: "schedules",
},
scheduleId: "sample-schedule",
spec: {
calendars: [
{
comment: "every wednesday at 8:30pm",
dayOfWeek: "WEDNESDAY",
hour: 20,
minute: 30,
},
],
},
});
Idiomatic Language Support
Code like a champion, in your language
Temporal allows you to simply code for durable execution, using one or more of our SDKs in Go, Java, Typescript, Python and .NET (and even deploy polyglot workflows).
const activities = proxyActivities<Activities>({
scheduleToCloseTimeout: "30 seconds",
});
interface GreetingParam {
name: string;
}
export async function greet(param: GreetingParam): Promise<string> {
return await activities.greet(param);
}
Human in the Loop
Incorporate human interactions
Use external sources – including human actions – that interact seamlessly with Workflows.
func Accept(ctx workflow.Context, input *AcceptWorkflowInput) (*AcceptWorkflowResult, error) {
err := emailCandidate(ctx, input)
if err != nil {
return nil, err
}
submission, err := waitForSubmission(ctx)
if err != nil {
return nil, err
}
return &AcceptWorkflowResult{Submission: submission},
nil
}
Execution Visibility
Never guess what's going on
Temporal allows you to inspect, replay, and rewind every Workflow execution, step by step.
Local Development Model
Develop locally, deploy globally
Write code in your preferred language locally, then deploy your workflows and activities using the same software delivery mechanisms you have today.
Netflix engineers spend less time writing logic to maintain application consistency or guard against failures because Temporal does it for them. The Temporal platform is easy to operate and fits naturally in our development workflow.
Rob Zienert
Senior Software Engineer, Netflix
It currently takes a team of 3 experienced developers roughly 20 weeks to build a new feature in our legacy systems and only 2 weeks using Temporal, that's akin to a team of 8 developers (using Temporal) being as productive as a team of 80.
Engineering Manager
Experienced Developer, Investment Management Firm
Don't fight dev patterns, ship code.
Event-Driven Architectures
Event-driven architectures and queue-driven design promise ease of deployment and scale, but are a development nightmare.
Without Temporal
Event-driven applications are loosely coupled at runtime, but highly coupled at build time. This creates great complexity for error handling and propagation of state across disparate services.
With Temporal
Application state, retries, and error handling are abstracted away so that you no longer have to code for them. System testing is a breeze because Temporal eliminates common failure scenarios.
SAGA & Distributed Transactions
The saga pattern ensures safe and consistent state across distributed services so that the failure of one operation within a sequence results in prior operations being reversed using compensating transactions.
Read now: Automating the Saga Pattern with Temporal ›
Without Temporal
Saga typically requires significant forethought as there is no central system to manage coordination and visibility. Debugging unexpected failure modes can be treacherous.
With Temporal
Workflow definitions allow you to more easily understand, debug, and modify sagas. Tighter coupling for compensations increases and your application code remains clean.
Batch Processing
Batch Processes are created to execute a well-defined function across large or even small sets of data.
Without Temporal
Often, batch processes can be quite large and when they fail, you have limited or no insight into where they failed, what completed and what hasn't.
With Temporal
Each execution within the batch process becomes a Workflow Execution with state captured, so that upon failure, you have insight into what completed and where to restart the process.
Scheduled Jobs & Cron
For years, we have relied on Cron to schedule jobs to be executed at a certain time or regular interval.
Without Temporal
Cron is a largely manual process that can be unreliable and provides limited to no controls over execution.
With Temporal
You can replace Cron with Scheduled Workflows to be reliably executed. You can start and pause them and even set up signals to start them on command for a Workflow.
State Machines
State machines are often used to define and manage valid state and transitions for entities within your application and depending on your application, they can be quite complex.
Read now: State Machines Simplified ›
Without Temporal
State machine code grows in complexity and length with the addition of each new state and maintenance and testing of them can be a challenge.
With Temporal
Complete state of your function and workflow is captured, so you no longer need to automate, track and validate state so you can eliminate or avoid state machines.
Temporal Cloud
Reliable, scalable, serverless Temporal in 11+ regions
Run the Temporal Service today, without hassle, and with peace of mind. Pay for only what you use with our managed service, built, managed, and supported by the creators of the Temporal project.
Temporal Cloud
Reliable, scalable, serverless Temporal in 11+ regions
Run the Temporal Service today, without hassle, and with peace of mind. Pay for only what you use with our managed service, built, managed, and supported by the creators of the Temporal project.
Temporal Cloud
Reliable, scalable, serverless Temporal in 11+ regions
Run the Temporal Service today, without hassle, and with peace of mind. Pay for only what you use with our managed service, built, managed, and supported by the creators of the Temporal project.
Build Invincible Apps
Give your apps and services durable execution.