Skip to content

Introduce versioning into the Java SDK #224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

halspang
Copy link
Member

Issue describing the changes in this PR

This commit adds the versioning feature from the dotnet SDK (durabletask-dotnet). This allows for the version to be passed via the context and for the worker to reject/fail orchestrations based on the provided version.

Pull request checklist

  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes are added to the CHANGELOG.md
  • I have added all required tests (Unit tests, E2E tests)

Additional information

Additional PR information

@halspang halspang requested a review from a team as a code owner May 21, 2025 05:31
@halspang halspang force-pushed the halspang/java_versioning branch 3 times, most recently from 6df61ee to c65b05e Compare May 21, 2025 18:17
@halspang halspang force-pushed the halspang/java_versioning branch from c65b05e to acc7e56 Compare June 6, 2025 04:24
@halspang halspang force-pushed the halspang/java_versioning branch from acc7e56 to 5bdebb8 Compare June 25, 2025 20:56
.findFirst()
.orElse(null);

logger.log(Level.INFO, String.format("Version from orchestration events: '%s'", version));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This log statement will be written for every orchestration work item, which I think will be too noisy. Let's log it only if version is not null. Alternatively, if you care about the case where version is not specified, then we should log this only when we find an EXECUTIONSTARTED event in the new event list.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this actually is just leftover debugging. I'm going to remove it, let me know if you think having it under those cases is important and I can add it specifically for that.

@halspang halspang force-pushed the halspang/java_versioning branch from 5bdebb8 to 30b53eb Compare June 25, 2025 22:38
This commit adds the versioning feature from the dotnet SDK
(durabletask-dotnet). This allows for the version to be passed via
the context and for the worker to reject/fail orchestrations based
on the provided version.

Signed-off-by: Hal Spang <[email protected]>
@halspang halspang force-pushed the halspang/java_versioning branch from 30b53eb to 6863dcc Compare June 25, 2025 23:41
@halspang halspang requested a review from cgillum June 27, 2025 17:48
@@ -379,6 +407,16 @@ public <V> Task<V> callSubOrchestrator(
}
createSubOrchestrationActionBuilder.setInstanceId(instanceId);

if (options instanceof NewSubOrchestrationInstanceOptions && ((NewSubOrchestrationInstanceOptions)options).getVersion() != null) {
NewSubOrchestrationInstanceOptions subOrchestrationOptions = (NewSubOrchestrationInstanceOptions) options;
if (subOrchestrationOptions.getVersion() != null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this if-check redundant with the check on line 410?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it sure was. I originally had it just there as I had it doing a .NET style type matching thing but then I found out that isn't supported through all the Java versions we have so the check got split up. Fixed.

}
} else if (num1 != null) {
// part1 is numeric, part2 is not - numeric versions come before non-numeric
return 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per our offline discussion, I'm still concerned that this error handling behavior is different from the behavior we have in the .NET case, where anything that doesn't match x.y.z is immediately reverts to string comparison logic.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to match the .NET style.

@halspang halspang force-pushed the halspang/java_versioning branch from c435427 to b450f9e Compare June 27, 2025 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants