A minimal HTTP server that demonstrates three core JobRunr background job patterns.
The app models a newsletter subscription service:
| Endpoint | Pattern | What happens |
|---|---|---|
POST /subscribe |
Fire-and-forget | Confirmation email sent as soon as a worker is free |
POST /confirm |
Delayed | Welcome email scheduled for execution 3 days later |
| (on startup) | Recurring | Weekly digest sent every Monday |
- Java 25 (JVM toolchain)
- Gradle (wrapper included)
kotlin-app/
├── src/main/kotlin/org/jobrunr/example/
│ ├── Main.kt # HTTP server entry point + JobRunr setup
│ └── services/
│ └── EmailService.kt # Simulated email jobs (prints to console)
└── build.gradle.kts
git clone https://github.com/jobrunr/jobrunr-examples.git
cd jobrunr-examples/kotlin-app
./gradlew runThe server starts on http://localhost:8080 and the JobRunr dashboard on http://localhost:8000/dashboard.
# Fire-and-forget: confirmation email sent immediately
curl -X POST "http://localhost:8080/subscribe?email=you@example.com"
# Delayed: welcome email scheduled 3 days from now
curl -X POST "http://localhost:8080/confirm?email=you@example.com"See the Getting started with Kotlin guide for a full walkthrough of the code.