resonate-durable-sleep-scheduled-work-java
Installation
SKILL.md
Resonate Durable Sleep + Scheduled Work — Java
Prerelease note.
resonate-sdk-javais published on Maven Central — pinio.resonatehq:resonate-sdk-java:0.1.1. The API mirrors the Python SDK and may change before a stable1.0. Requires Java 21+ (virtual threads, a feature generally available in Java 21). Every code block here is compile-verified against0.1.1and drawn fromexample-countdown-java/example-quickstart-javaanddevelop/java.mdx(docs PR #230).
Overview
Two related capabilities in the Java SDK:
- Durable sleep inside a workflow —
ctx.sleep(Duration)pauses execution; the worker process can exit and resume later without losing its place. The server holds the timer promise; the cost is one promise record, not process uptime. - Scheduled / recurring work —
r.schedule(...)registers a cron schedule that periodically invokes a registered function. The Java SDK includes a top-level Schedule API (plus the lower-levelr.schedulessub-client); the Go SDK does not expose one yet. This removes the need for an in-workflow sleep loop or an external cron trigger.
Both patterns are durable: Resonate holds the continuation (or the schedule) in its store, not in a long-running thread.