temporalio / sdk-java

Temporal Java SDK
https://temporal.io
Apache License 2.0
224 stars 147 forks source link

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

Closed Quinn-With-Two-Ns closed 2 days ago

Quinn-With-Two-Ns commented 2 weeks ago

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 https://github.com/temporalio/sdk-java/issues/2181

Quinn-With-Two-Ns commented 1 week ago

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

dandavison commented 1 week ago

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.