Title: Add Durable Task middleware support · Issue #285 · microsoft/durabletask-java · GitHub
Open Graph Title: Add Durable Task middleware support · Issue #285 · microsoft/durabletask-java
X Title: Add Durable Task middleware support · Issue #285 · microsoft/durabletask-java
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/cros...
Open Graph 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/...
X 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/...
Opengraph URL: https://github.com/microsoft/durabletask-java/issues/285
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add Durable Task middleware support","articleBody":"## Summary\n\nTrack adding SDK-level Durable Task middleware support to the Java SDK, aligned with the .NET reference implementation.\n\nReference spec: https://github.com/microsoft/durabletask-dotnet/blob/feature/durable-task-middleware/doc/cross-sdk-middleware.md\n.NET user guide: https://github.com/microsoft/durabletask-dotnet/blob/feature/durable-task-middleware/doc/durable-task-middleware.md\nMotivation: https://github.com/Azure/azure-functions-durable-extension/issues/3054\n\nThe 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.\n\n## Proposed shape\n\nNames are illustrative, not final API commitments.\n\n```java\nworkerBuilder.useOrchestrationMiddleware((ctx, next) -> {\n if (!ctx.isReplaying()) {\n logger.info(\"starting orchestration {}\", ctx.getInstanceId());\n }\n\n return next.invoke(ctx);\n});\n\nworkerBuilder.useActivityMiddleware((ctx, next) -> {\n Optional\u003cObject> cached = cache.tryGet(ctx.getName(), ctx.getInput());\n if (cached.isPresent()) {\n ctx.setResult(cached.get());\n return CompletableFuture.completedFuture(null);\n }\n\n return next.invoke(ctx);\n});\n```\n\n## Design points to cover\n\n- Builder-level registration APIs for orchestration and activity middleware.\n- Registration ordering: first registered middleware runs outermost and unwinds last.\n- 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`.\n- A feature collection keyed by `Class\u003cT>` or another type-safe Java abstraction.\n- Integration with dependency injection frameworks where present, without requiring a particular DI container.\n- 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.\n- Activity middleware short-circuiting through an explicit `setResult` API.\n- Host integration pattern for Azure Functions or other hosts to attach invocation context through features instead of durable middleware depending on host middleware internals.\n\n## Acceptance criteria\n\n- Orchestration and activity middleware APIs are exposed at the durable worker/builder level.\n- Middleware executes in registration order and unwinds in reverse order.\n- Orchestration middleware must call `next.invoke(ctx)` exactly once when completing successfully; missing or duplicate calls are rejected where feasible.\n- Activity middleware can call `next.invoke(ctx)` once or short-circuit only through `ctx.setResult(...)`; duplicate `next` is invalid.\n- Host-specific objects can be passed through features without serialization into durable history.\n- Documentation covers replay determinism and the difference between durable middleware and host/Functions middleware.\n- Tests cover registration ordering, context population, feature access, orchestration next-call validation, and activity short-circuiting.\n- No wire protocol or protobuf changes are required.\n- Entity middleware is out of scope for v1.\r\n","author":{"url":"https://github.com/cgillum","@type":"Person","name":"cgillum"},"datePublished":"2026-05-05T22:46:26Z","url":"https://github.com/microsoft/durabletask-java/issues/285"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e0e4de43-b41e-f43a-cc26-6e09f112a7d7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8BE8:2218F3:658BA:89D3C:6AFE31A3 |
| html-safe-nonce | af4b798400667fbfad770c6e49a7a0f3c8f98833332d48d3e84ad36de6aa6661 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QkU4OjIyMThGMzo2NThCQTo4OUQzQzo2QUZFMzFBMyIsInZpc2l0b3JfaWQiOiI1NDY2MDY2Mzk2NzgzNzE4ODE5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 9ecd682e2936b2247a86cdc8109e25ca8407a4ea913e195bd03967d514848174 |
| hovercard-subject-tag | issue:4387548499 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/durabletask-java/285/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a964efbb0dc929179c510505f9acfba05c19aeef5b69a9b51e5ebdcda73387a9/microsoft/durabletask-java/issues/285 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a964efbb0dc929179c510505f9acfba05c19aeef5b69a9b51e5ebdcda73387a9/microsoft/durabletask-java/issues/285 |
| og:image:alt | 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/... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | cgillum |
| hostname | github.com |
| expected-hostname | github.com |
| None | d70e31220a67f6376c108d2416fa8e7df854c1065b1672ab7a88ab6dc3a809e2 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/durabletask-java git https://github.com/microsoft/durabletask-java.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 452823832 |
| octolytics-dimension-repository_nwo | microsoft/durabletask-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 452823832 |
| octolytics-dimension-repository_network_root_nwo | microsoft/durabletask-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ccb88d9c92abe69245b429398c8a57ae87070c7c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width