Skip to content

resonatehq-examples/example-durable-sleep-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

durable sleep banner

Durable sleep

Resonate TypeScript SDK

This example application showcases the sleep API that enables a function to reliably sleep for days, weeks, or even years if needed.

Problem

A business process may need to sleep for a period much longer than the typical lifetime of a process.

Since a process is more likely to crash the longer it is alive, and if a business process needs to suspend (or "sleep") for days, weeks, or even years, then developers are often forced to use cron jobs as a means to reawaken long-sleeping processes.

This leads to complexity that is hard to reason about, test, and rely on.

Solution

Resonate enables developers to sleep directly in their workflows without leaving the process running idle, reducing implementation complexity while ensuring the business process can survive across process crashes.

How to run this example

Run a Resonate Server:

brew install resonatehq/tap/resonate
resonate dev

If you don't have brew, try one of these other installation options.

Install dependencies:

bun install

Run the worker

bun run worker.ts

Run the client

bun run client.ts

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •