ScheduCloud
· 1 min
goschedulerpostgresqlkafkacron
A clustered job scheduler with a REST API, written in Go. Jobs say what to do (call a URL, publish a Kafka record), triggers say when (every N seconds, or a cron expression). Run as many instances as you like against one PostgreSQL database: each due trigger fires on exactly one of them.
ScheduCloud was a Spring Boot application on Quartz; this is a rewrite with the same REST paths.
What is inside?
- Jobs:
REST_GETcalls a URL (a status of 400 or above fails the run),KAFKA_EVENTpublishes one record to a topic. - Triggers:
SIMPLEfires at a start time and then every N milliseconds;CRONtakes a cron expression with an optional seconds field and a time zone. - The data of a trigger is merged over the data of its job, so one job can serve several triggers with different targets.
- Every run is recorded, including on which instance it happened:
GET /api/job-runs. - A PostgreSQL store, or an in-memory one for trying it out.
docker compose up --build # PostgreSQL + two scheduler instances on ports 8081 and 8082
# a trigger that fires at 09:00 on weekdays, Istanbul time
curl -X POST localhost:8082/api/triggers -d '{
"key": {"name": "weekday-morning", "group": "demo"},
"jobKey": {"name": "ping", "group": "demo"},
"triggerType": "CRON",
"cronSchedule": {"cronExpression": "0 0 9 * * MON-FRI", "timeZone": "Europe/Istanbul"}
}'
Source code: github.com/ergulcu/schedu-cloud