Skip to content
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

Add type safe API to execute an async update workflow request #2320

Merged
merged 8 commits into from
Nov 26, 2024

Conversation

Quinn-With-Two-Ns
Copy link
Contributor

@Quinn-With-Two-Ns Quinn-With-Two-Ns commented Nov 14, 2024

Add type safe API to execute an async update workflow request.

Open questions we should resolve:

  1. Is the name executeUpdate acceptable? We could also use update or startUpdate the Java SDK is not very consistent here
  2. Is taking UpdateOptions OK or do we want a new type here? Reusing is nice since it reduces the number of types, but has some redundant fields like name, and type.

closes #2181

@Quinn-With-Two-Ns Quinn-With-Two-Ns marked this pull request as ready for review November 18, 2024 22:31
@Quinn-With-Two-Ns Quinn-With-Two-Ns requested a review from a team as a code owner November 18, 2024 22:31
@Quinn-With-Two-Ns
Copy link
Contributor Author

@dandavison FYI The naming of this API may be relevant to your work on update with start

@dandavison
Copy link
Contributor

Is the name executeUpdate acceptable? We could also use update or startUpdate the Java SDK is not very consistent here

The only place that the Java SDK uses "execute" AFAIK is WorkflowClient.execute which returns a (future of) workflow result. So across all SDKs, we have a pattern that "execute" always means "returning result, not run/handle" (with the exception of Go's ExecuteWorkflow which is a clear outlier -- if we were naming that nowadays we'd call it StartWorkflow.) So that argues that, since the new methods added here return WorkflowUpdateHandle, they should not have "execute" in their name.

So startUpdate seems best here, since in Java we have the pattern untypedStub.startUpdate => UpdateHandle and untypedStub.update => UpdateResult.

Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

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

No comment on update options

* @param options update options
* @return WorkflowUpdateHandle that can be used to get the result of the update
*/
static WorkflowUpdateHandle<Void> executeUpdate(
Copy link
Member

Choose a reason for hiding this comment

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

IMO this should be called startUpdate even though I know Java is not that consistent here. I think it's clearer to understand and allows us to offer a real executeUpdate later if we wanted. I'd also support update.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep seems there is consensus that we should call this startUpdate so I renamed it.

@Quinn-With-Two-Ns Quinn-With-Two-Ns merged commit 89021d0 into temporalio:master Nov 26, 2024
8 checks passed
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.

Type safe async update API
3 participants