Repository navigation
Conversation
NewWorkflowOptions.setOrdering(new WorkflowOrdering(key, policy)) queues the workflow behind the other workflows of its app started with the same key. OrderingFailurePolicy (CONTINUE, BLOCK, CANCEL) sets what the workflow does when the workflow before it did not complete successfully. WorkflowOrdering(key) defaults to CONTINUE. NewOrchestrationInstanceOptions carries the proto WorkflowOrdering to DurableTaskGrpcClient, which sets CreateInstanceRequest.ordering only when one is given. Moves durabletask.proto.baseurl in pom.xml to durabletask-protobuf v0.8.0, the first release with WorkflowOrdering. Signed-off-by: joshvanl <me@joshvanl.dev>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new scheduling API lacks the required runnable example and real-runtime integration tests covering same-key ordering and failure policies.
2 open issues
What changed in this PR
Adds workflow ordering to the Java SDK, allowing same-key workflows to queue with configurable predecessor-failure handling.
Changes:
- Adds ordering options with CONTINUE, BLOCK, and CANCEL policies.
- Passes ordering through workflow scheduling to gRPC requests.
- Updates protobuf definitions to v0.8.0 and adds request-mapping tests.
| File | Description |
|---|---|
sdk-workflows/src/test/java/io/dapr/workflows/task/DurableTaskGrpcClientScheduleTest.java |
Tests ordering presence and omission in requests. |
sdk-workflows/src/test/java/io/dapr/workflows/client/DaprWorkflowClientTest.java |
Tests ordering conversion during scheduling. |
sdk-workflows/src/main/java/io/dapr/workflows/task/client/NewOrchestrationInstanceOptions.java |
Carries protobuf ordering options. |
sdk-workflows/src/main/java/io/dapr/workflows/task/client/DurableTaskGrpcClient.java |
Adds ordering to creation requests when supplied. |
sdk-workflows/src/main/java/io/dapr/workflows/client/WorkflowOrdering.java |
Defines ordering keys and the default policy. |
sdk-workflows/src/main/java/io/dapr/workflows/client/OrderingFailurePolicy.java |
Defines and maps failure policies. |
sdk-workflows/src/main/java/io/dapr/workflows/client/NewWorkflowOptions.java |
Exposes workflow ordering configuration. |
sdk-workflows/src/main/java/io/dapr/workflows/client/DaprWorkflowClient.java |
Converts ordering into orchestration options. |
pom.xml |
Pins Durable Task protobuf definitions to v0.8.0. |
Review effort: Balanced
| * @param ordering the ordering of the new workflow | ||
| * @return this {@link NewWorkflowOptions} object | ||
| */ | ||
| public NewWorkflowOptions setOrdering(WorkflowOrdering ordering) { |
Comment on lines
+223
to
+225
| if (options.getOrdering() != null) { | ||
| builder.setOrdering(options.getOrdering()); | ||
| } |
examples/workflows/ordering processes the orders of one customer in sequence under one key, then shows the CANCEL policy terminating an order whose predecessor failed. Its README runs the worker and client as mechanical-markdown steps. Like the schedules example, it is not in the validation workflow, which runs against the Dapr 1.19 release. WorkflowOrderingIT runs against the edge images, tagged dapr-head like WorkflowSchedulesIT. It checks that a same-key workflow stays pending while the one before it runs, and the CONTINUE, CANCEL and BLOCK policies after a failure, including a purge releasing a blocked workflow. WorkflowOrderingTest covers the key-only constructor defaulting to CONTINUE and the mapping of every OrderingFailurePolicy to its proto value. Signed-off-by: joshvanl <me@joshvanl.dev>
Comment on lines
+40
to
+41
| client.waitForWorkflowStart("order-1", TIMEOUT, false); | ||
| System.out.printf("order-1 is %s, order-2 is %s%n", status(client, "order-1"), status(client, "order-2")); |
Comment on lines
+68
to
+69
| <!-- STEP | ||
| name: Run Workflow Ordering Worker |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1927 +/- ##
============================================
+ Coverage 82.89% 83.01% +0.12%
- Complexity 3977 3998 +21
============================================
Files 360 363 +3
Lines 11971 12003 +32
Branches 1339 1341 +2
============================================
+ Hits 9923 9964 +41
+ Misses 1546 1537 -9
Partials 502 502 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
javier-aliaga
requested changes
Dec 4, 2026
javier-aliaga
left a comment
Contributor
There was a problem hiding this comment.
@JoshVanL can you fix copilots comments?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


NewWorkflowOptions.setOrdering(new WorkflowOrdering(key, policy)) queues
the workflow behind the other workflows of its app started with the same
key. OrderingFailurePolicy (CONTINUE, BLOCK, CANCEL) sets what the
workflow does when the workflow before it did not complete successfully.
WorkflowOrdering(key) defaults to CONTINUE.
NewOrchestrationInstanceOptions carries the proto WorkflowOrdering to
DurableTaskGrpcClient, which sets CreateInstanceRequest.ordering only
when one is given.
Moves durabletask.proto.baseurl in pom.xml to durabletask-protobuf
v0.8.0, the first release with WorkflowOrdering.
Signed-off-by: joshvanl me@joshvanl.dev