-
Notifications
You must be signed in to change notification settings - Fork 152
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 support for attaching to a running workflow #2424
Add support for attaching to a running workflow #2424
Conversation
Marking as draft while I add tests, will need #2415 merged and probably a server release to merge |
} | ||
|
||
public OnConflictOptions build() { | ||
return new OnConflictOptions(attachRequestId, attachCompletionCallbacks, attachLinks); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The server doesn't allow attaching callbacks without also attaching a request ID (as of yesterday). I'm wondering if we should verify that SDK side and document it on the builder setters. We definitely should in the api (@rodrigozhou).
* already running, the options specifies the actions to be taken on the running workflow. If | ||
* not set or use together with any other WorkflowIDConflictPolicy, this parameter is ignored. | ||
* | ||
* <p>WARNING: Not intended for User Code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish there was a way to hide this. Maybe with a private subclass and cast?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't be private because it needs to be accessible by the Internal
package. Passing them through a thread local is an option, but puts a requirement on the calling thread. I think we should revisit before we GA
temporal-sdk/src/main/java/io/temporal/internal/statemachines/NexusOperationStateMachine.java
Show resolved
Hide resolved
if (!async) { | ||
startedCallback.apply(Optional.empty(), null); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just keep all of this logic in notifyStarted()
but this is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing blocking
+ '}'; | ||
} | ||
|
||
private OnConflictOptions( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pedantic, but a bit strange to me to see a constructor below the instance methods
* io.temporal.api.enums.v1.WorkflowIdConflictPolicy#WORKFLOW_ID_CONFLICT_POLICY_USE_EXISTING} | ||
*/ | ||
@Experimental | ||
public class OnConflictOptions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrmm, it was my understanding that we were going to hive this from users, though I know that is difficult in Java. If instead we're ok with showing to users but marking experimental, I think we should do the same in Go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't avoid exposing it given the structure of the Java SDK, just because the Java SDK has this unfortunate limitation doesn't mean other SDKs should copy it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the question becomes should other SDKs follow Go's lead or Java's lead here. Sounds like we are saying Java will be the outlier instead of updating Go to expose as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes other SDKs should not copy it
515b050
to
dc2f6e9
Compare
Add support for attaching to a running workflow.
See similar Go PR: temporalio/sdk-go#1797