Distributed Async Await

A dead simple programming model for modern applications

durable-payment.ts
1import { Resonate, Context } from "@resonatehq/sdk";
2
3// 1) Initialize Resonate executor
4const resonate = new Resonate();
5
6// 2) Register an async function as a durable async function
7resonate.register("purchase", purchase);
8
9async function purchase(ctx: Context, user: User, song: Song): Promise<Status> {
10  const charged = await ctx.run(charge, user, song);
11  const granted = await ctx.run(access, user, song);
12  return { charged, granted };
13}
14
15// 3) Setup logic for routing to durable async function
16app.post("/purchase", async (req: Request, res: Response) => {
17  const user = { id: req.body?.user ?? 1 };
18  const song = { id: req.body?.song ?? 1, price: 1.99 };
19
20  // 4) uniquely identify the execution
21  const id = `purchase-${user.id}-${song.id}`;
22  try {
23    res.send(await resonate.run("purchase", id, user, song));
24  } catch (err) {
25    res.status(500).send("Could not purchase song");
26  }
27});
Echo

What is Distributed Async Await?

Distributed Async Await extends the async await programming model beyond the boundaries of a single process and makes distributed computing a first-class citizen.

Resonate has an incremental path to adoption

By extending instead of replacing async await, we have created an incremental transition from the world of concurrent programming into the world of distributed programming

1. Resonate Library

Get retries, rate limiting, timeouts, cancelation, metrics, and tracing. No infrastructure required.

2. Resonate Library + Resonate Server

Run functions for minutes, hours, days, weeks, month, or years, regardless of hardware or software failures.

3. Resonate Library + Resonate Server + Resonate Workers

Run on prem, on the edge, in the cloud, or go serverless.