Skip to main content

Resonate Server API

The Resonate Server has an API that the SDKs use to interact with the Server.

The Server has the following API surface:

Promises API

The Promise API is the core of the Resonate Server. It enables the storage of computational progress in a database. By doing this, we can offer recoverability to processes using our SDK even after a process crash due to hardware or software failures. Currently, the Server supports the following databases:

  • SQLite (default)
  • PostgreSQL

Want to the Resonate Server to support an additional database? File a Github Issue or feel free to contribute to the Resonate Server codebase.

Tasks API

The Tasks API allows users to route durable promises to a set of workers. This is very useful for implementing the Fan-out/Fan-in pattern. Unlike the other APIs, this requires a small amount of server configuration to set up the routing rules.

Schedules API

The Schedules API allows users to schedule the creation of durable promises with a cron expression. This is useful for creating stateful reminders, also known as cron jobs. Applications can either poll for the created stateful reminders, which will persist beyond crashes, or pair it with the distributed tasks framework. When paired, the creation of a durable promise automatically gets routed and triggers a process at certain intervals.

Locks API

The Distributed Locks API is used to provide mutually exclusive access to a resource. This is primarily used as an internal API for the SDKs and Workers, but can also be used as a standalone API by the user.

note

One unique feature is the processId parameter, which uniquely identifies a process and allows for optimized updates of all locks associated with that process. By including the processId in the lock acquisition and heartbeat requests, the SDK can easily update the expiration time for all locks held by a specific process in a single API call.