Add Durable Task middleware support
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- java
- Domain
- backend-api-design
Research direction
Start by reading the linked cross-SDK middleware specification and .NET user guide, then inspect the durable worker/builder APIs in this Java SDK. Use the proposed orchestration and activity middleware entry points to map the design, including context features and validation rules. Done means the listed acceptance tests, documentation, and host-feature integration are implemented without wire or protobuf changes.
Written by the indexing model from the issue text.
Description
Summary
Track adding SDK-level Durable Task middleware support to the Java SDK, aligned with the .NET reference implementation.
Reference spec: https://github.com/microsoft/durabletask-dotnet/blob/feature/durable-task-middleware/doc/cross-sdk-middleware.md
.NET user guide: https://github.com/microsoft/durabletask-dotnet/blob/feature/durable-task-middleware/doc/durable-task-middleware.md
Motivation: https://github.com/Azure/azure-functions-durable-extension/issues/3054
The spec may shift until the .NET v1 implementation is merged. This issue is intended to track the Java design and implementation work so it can follow the same durable middleware contract with idiomatic API names.
Proposed shape
Names are illustrative, not final API commitments.
workerBuilder.useOrchestrationMiddleware((ctx, next) -> {
if (!ctx.isReplaying()) {
logger.info("starting orchestration {}", ctx.getInstanceId());
}
return next.invoke(ctx);
});
workerBuilder.useActivityMiddleware((ctx, next) -> {
Optional<Object> cached = cache.tryGet(ctx.getName(), ctx.getInput());
if (cached.isPresent()) {
ctx.setResult(cached.get());
return CompletableFuture.completedFuture(null);
}
return next.invoke(ctx);
});
Design points to cover
- Builder-level registration APIs for orchestration and activity middleware.
- Registration ordering: first registered middleware runs outermost and unwinds last.
- Context interfaces that expose durable task name, instance ID, version/parent/tags where available, input, raw input where available, replay state for orchestrations, features, and result after
next. - A feature collection keyed by
Class<T>or another type-safe Java abstraction. - Integration with dependency injection frameworks where present, without requiring a particular DI container.
- Orchestration middleware determinism guidance for replay, including replay-safe logging and avoiding nondurable
CompletableFuture/threading usage, wall-clock time, random values, file/network I/O, and mutable process state. - Activity middleware short-circuiting through an explicit
setResultAPI. - Host integration pattern for Azure Functions or other hosts to attach invocation context through features instead of durable middleware depending on host middleware internals.
Acceptance criteria
- Orchestration and activity middleware APIs are exposed at the durable worker/builder level.
- Middleware executes in registration order and unwinds in reverse order.
- Orchestration middleware must call
next.invoke(ctx)exactly once when completing successfully; missing or duplicate calls are rejected where feasible. - Activity middleware can call
next.invoke(ctx)once or short-circuit only throughctx.setResult(...); duplicatenextis invalid. - Host-specific objects can be passed through features without serialization into durable history.
- Documentation covers replay determinism and the difference between durable middleware and host/Functions middleware.
- Tests cover registration ordering, context population, feature access, orchestration next-call validation, and activity short-circuiting.
- No wire protocol or protobuf changes are required.
- Entity middleware is out of scope for v1.
- Dominant language
- Java
- Stars
- 29
- Forks
- 18
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/durabletask-java
-
Needs: Triage :mag:
Difficulty 4/5 3-5 days Newbie friendliness 48/100
microsoft/durabletask-java#303 ·
-
Needs: Triage :mag:
Difficulty 4/5 3-5 days Newbie friendliness 45/100
microsoft/durabletask-java#290 · 2 comments ·
-
Needs: Triage :mag:
Difficulty 3/5 1-2 days Newbie friendliness 68/100
microsoft/durabletask-java#276 ·
-
Enhancement
microsoft/durabletask-java#274 · 1 reaction · 2 assignees ·
-
Needs: Triage :mag:
Difficulty 4/5 3-5 days Newbie friendliness 42/100
microsoft/durabletask-java#270 ·
All issues in microsoft/durabletask-java
Similar issues
-
bug untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
opensearch-project/ml-commons#5094 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
emitter:client:csharp feature
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
affects/8.10 affects/8.9 component/clients kind/bug likelihood/mid severity/mid
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Two open-case totals on one screen: the Programs tile says 15,858 and the nav badge says 15,868 Openbug frontend maui-pilot
Difficulty 2/5 1-3 hours Newbie friendliness 72/100