Add temporal module: workflows, activities, retries, saga, signals, versioning, Spring Boot starter
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b5uEyg58znuchZ8C8i
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
# temporal
|
||||
|
||||
Temporal Java SDK with Spring Boot: a durable order saga, retries, signals/queries/timers, workflow versioning with replay, and a REST layer. Everything runs in-memory via `TestWorkflowEnvironment`; no Temporal server, no Docker.
|
||||
|
||||
| Component | Version (verified on Maven Central, 29 Nov 2026) |
|
||||
|---|---|
|
||||
| Temporal Java SDK (`temporal-sdk`, `temporal-testing`, `temporal-spring-boot-starter`) | 1.41.1 |
|
||||
| Spring Boot | 4.2.0 |
|
||||
| JDK | Temurin 25.0.5.1 |
|
||||
| Temporal CLI / dev server (optional) | 1.10.1 (server 1.32.2) |
|
||||
|
||||
## Run
|
||||
|
||||
```bash
|
||||
export JAVA_HOME=/path/to/jdk-25
|
||||
mvn test # regenerates output/01..11
|
||||
scripts/run-all.sh # also output/12 when the temporal CLI is on PATH
|
||||
mvn spring-boot:run # app with the in-memory test server: POST /orders, GET /orders/{id}
|
||||
```
|
||||
|
||||
Against a real server: `scripts/dev-server.sh` in one shell, then `mvn spring-boot:run -Dspring-boot.run.profiles=server`.
|
||||
|
||||
## Layout
|
||||
|
||||
| Path | What |
|
||||
|---|---|
|
||||
| `hello/` | smallest workflow + activity |
|
||||
| `retry/` | retry policy, non-retryable failures |
|
||||
| `saga/` | order saga with compensations, idempotent activities, in-memory `Ledger` |
|
||||
| `signal/` | signal, query and a 24h timer |
|
||||
| `versioning/` | V1, a naive V2, a `getVersion`-guarded V2 |
|
||||
| `web/` | REST controllers using the Spring Boot starter |
|
||||
| `output/` | captured real output, one file per scenario |
|
||||
|
||||
## Output index
|
||||
|
||||
| File | Scenario |
|
||||
|---|---|
|
||||
| `01-hello-history.txt` | event history of the smallest workflow |
|
||||
| `02-retries.txt` | transient failure, exhausted retries, non-retryable failure |
|
||||
| `03-saga-happy-path.txt` | saga success and its history |
|
||||
| `04-saga-out-of-stock.txt` | compensation after the second step fails |
|
||||
| `05-saga-late-failure.txt` | reverse-order compensation after the third step fails |
|
||||
| `06-saga-idempotent-retry.txt` | activity retried after its effect already happened |
|
||||
| `07-saga-no-worker-yet.txt` | workflow started before any worker existed |
|
||||
| `08-signals-queries-timers.txt` | signal, query, 24h timer skipped by the test server |
|
||||
| `09-versioning-replay.txt` | replay breaks on a naive change, passes with `getVersion` |
|
||||
| `10-spring-boot-rest.txt` | REST calls through the Spring Boot starter |
|
||||
| `11-workflow-id-reuse.txt` | what a second start under the same workflow id does |
|
||||
| `12-crash-recovery.txt` | `kill -9` the JVM mid-workflow, new JVM finishes it (real dev server) |
|
||||
|
||||
Run ids and the random workflow id in `12` differ between runs.
|
||||
Reference in New Issue
Block a user