Skip to main content

Java Workflow SDK

Build stateful, long-running, reliable workflows using the Dapr Workflow Java SDK that run on Diagrid. The Dapr Workflow Java SDK provides a powerful way to orchestrate complex business processes from within your Java applications, with support for popular frameworks like Spring Boot and Quarkus.

Prefer to start from a diagram? Use Dapr Skills for Claude Code to generate a runnable Java Dapr Workflow project from a workflow diagram, then iterate with this SDK. For local monitoring of running workflows, use the Dapr Dev Dashboard.

Start hereโ€‹

Catch exceptions around activities safelyโ€‹

Do not swallow OrchestratorBlockedException

When a workflow waits for an activity, the SDK stops the workflow function by throwing an internal OrchestratorBlockedException. A catch (Exception e) around ctx.callActivity(...).await() catches it. The workflow then never continues, and its status stays running.

This matters for saga patterns, where a catch block runs the compensating activities.

Catch OrchestratorBlockedException first and re-throw it, then handle the real failure:

import io.dapr.durabletask.interruption.OrchestratorBlockedException;

try {
ctx.callActivity("ChargeCard", order, Receipt.class).await();
} catch (OrchestratorBlockedException e) {
throw e; // let the SDK pause the workflow until the activity completes
} catch (Exception e) {
// A real activity failure: run the compensations here.
ctx.callActivity("RefundOrder", order, Void.class).await();
throw new IllegalStateException("payment failed, order refunded", e);
}

You can also catch only the activity failure type, io.dapr.durabletask.TaskFailedException, instead of Exception. A worker that re-throws the exception does not fix instances that an earlier version of the worker already left stuck.

Observabilityโ€‹

Configure and use observability features to monitor and debug workflows.

Getting Startedโ€‹