Skip to content

resonatehq-examples/example-durable-sleep-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

durable sleep banner

Durable sleep

Resonate TypeScript SDK

This example application showcases the Context.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 of time that is much longer than the expected lifetime of a process.

In other words, a process is likely to crash the longer it is alive, and if a business process needs to suspend—or "sleep"—for days, weeks, or even years, developers are often forced to use cron jobs as a means to reawaken long sleeping processes.

This leads to complexity that is difficult to reason about, test, and trust.

Solution

Resonate enables developers to handle that sleep directly in their workflows, reducing the complexity of the implementation while also knowing that it can survive process crashes.

How to run this example

Run a Resonate Server:

brew install resonatehq/tap/resonate
resonate serve

If you don't have brew, try one of these other installation options: https://docs.resonatehq.io/operate/server-installation

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 2

  •  
  •