restate-cron
A Rust library for adding cron scheduling capabilities to Restate services.
Installation
Usage
The library provides a CronJob object service that you can add to your Restate endpoint:
use ObjectImpl;
use *;
async
Custom Rhai engine
You can provide a custom Rhai engine with additional functions for dynamic payloads:
use ObjectImpl;
let mut engine = new;
// Register custom functions...
let service = new;
API
The CronJob object exposes these handlers:
| Handler | Method | Description |
|---|---|---|
create |
POST | Create a new cron job |
replace |
POST | Create or replace an existing job |
cancel |
POST | Cancel an existing job |
get |
GET | Retrieve job details |
getNextRun |
GET | Get next scheduled execution time |
Job specification
Schedule
Standard cron expression with seconds precision:
┌──────────── second (0-59)
│ ┌────────── minute (0-59)
│ │ ┌──────── hour (0-23)
│ │ │ ┌────── day of month (1-31)
│ │ │ │ ┌──── month (1-12)
│ │ │ │ │ ┌── day of week (0-6, Sunday=0)
│ │ │ │ │ │
* * * * * *
License
Licensed under the MIT License.