Skip to content

Latest commit

 

History

History

java

README.md

Dex Java examples

These examples target io.superdurable:dex-sdk:1.44.0 (io.superdurable.dex).

The sample process runs one pull Worker and an HTTP controller on port 8080. The Worker needs only an outbound connection to the Dex Server. One Registry and disk BlobCache are shared by its Worker and Client.

Layout

src/main/java/io/superdurable/dex/
├── products/       # real-world business scenarios
├── patterns/       # design patterns
├── primitives/     # one minimal example per Dex primitive
└── shared/         # mock services and HTTP helpers

HTTP routes use category prefixes:

  • /products/<kebab>/... — e.g. /products/job-post/create
  • /patterns/<kebab>/... — e.g. /patterns/polling/start
  • /primitives/<kebab>/... — e.g. /primitives/step/start

Run locally

dexcli dev
./gradlew bootRun

The Worker synchronizes all registered Indexed Attributes with Dex before it opens outbound task streams; no backend CLI registration is required.

The examples share namespace-level slots by index type: keyword1, text1, int1, and numbered later slots such as keyword2. Use a fresh local store and a new port after changing an example's index schema.

Application searches must constrain FlowType and parenthesize caller filters. The sample search endpoints enforce their Flow type.

Use JDK 17+ to run Gradle; the examples build and run on the newest Java release by default (the toolchain downloads automatically), and -PjavaVersion=17 (or 21, 25, ...) selects another JDK. Defaults connect to Dex at localhost:8801. Override with DEX_FLOW_SERVICE_ADDRESS, DEX_EXAMPLES_HTTP_ADDRESS, and DEX_BLOB_CACHE_DIR.

Worker bind addresses, advertised targets, and Worker mode selection have been removed. Delete DEX_WORKER_BIND_ADDRESS, DEX_WORKER_TARGET, and DEX_EXAMPLES_WORKER_MODE from existing configurations. Every Worker uses pull routing, with 64 concurrent tasks for the shared example process. Client routing is automatic.

Verify

Run the integration suite against an isolated dexcli dev environment:

./run-integration-tests.sh

The tests use server-zd and pull Workers. DEX_INTEG_ENGINE=zd remains accepted. Set DEX_SERVER_ZD_BINARY to reuse a built dex-server-zd.

Examples catch concrete types from io.superdurable.dex.exceptions. FlowNotFoundException is for read operations with no matching execution; FlowNotActiveOrNotFoundException covers missing RPC targets and mutations that cannot use a closed Flow. A query-only RPC can read a retained closed Flow when it has no locks, transactionality, durable effects, or Server-forced Update routing. At that confirmed read boundary, return the missing-target result directly without lifecycle probes, retries, or history decoding. Preserve other service and Worker failures. ErrorSubStatus remains diagnostic metadata and is not used for control flow.

The Go examples support ./run-e2e-tests.sh --keep-running to leave Dex running after E2E tests for manual HTTP exploration.

Products

Patterns

Under patterns/:

Primitives

Minimal examples under primitives/: