-
Notifications
You must be signed in to change notification settings - Fork 220
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
Set Nexus operation ID on callback headers #1710
Merged
+40
−25
Merged
Changes from 7 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
30b6eac
Set Nexus operation ID on callback headers
pdoerner 6b0260f
comment
pdoerner eb6e759
return error on missing workflow ID
pdoerner a1cbd2d
bump nexus sdk version
pdoerner 0866c1b
Merge branch 'master' into nexus-complete-before-start
pdoerner 1dccd59
error message
pdoerner bb25b69
tidy
pdoerner df8d203
tidy
pdoerner db5178e
tidy
pdoerner 9c8298f
tidy
pdoerner 39b623e
tidy
pdoerner 1679683
case insensitive header
pdoerner 9437de3
test
pdoerner 2197e11
test
pdoerner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -203,6 +203,9 @@ func (o *workflowRunOperation[I, O]) Name() string { | |
return o.options.Name | ||
} | ||
|
||
// Start begins an async Nexus operation backed by a workflow. | ||
// The Operation ID returned in the response should not be modified because it is used for cancelation and reporting | ||
// completion. | ||
func (o *workflowRunOperation[I, O]) Start( | ||
ctx context.Context, | ||
input I, | ||
|
@@ -324,12 +327,21 @@ func ExecuteUntypedWorkflow[R any]( | |
if startWorkflowOptions.TaskQueue == "" { | ||
startWorkflowOptions.TaskQueue = nctx.TaskQueue | ||
} | ||
if startWorkflowOptions.ID == "" { | ||
return nil, internal.ErrMissingWorkflowID | ||
} | ||
|
||
if nexusOptions.RequestID != "" { | ||
internal.SetRequestIDOnStartWorkflowOptions(&startWorkflowOptions, nexusOptions.RequestID) | ||
} | ||
|
||
if nexusOptions.CallbackURL != "" { | ||
if nexusOptions.CallbackHeader == nil { | ||
nexusOptions.CallbackHeader = make(nexus.Header) | ||
} | ||
if _, set := nexusOptions.CallbackHeader[nexus.HeaderOperationID]; !set { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: should we use the case insensitive operations on the headers? I guess |
||
nexusOptions.CallbackHeader[nexus.HeaderOperationID] = startWorkflowOptions.ID | ||
} | ||
internal.SetCallbacksOnStartWorkflowOptions(&startWorkflowOptions, []*common.Callback{ | ||
{ | ||
Variant: &common.Callback_Nexus_{ | ||
|
Oops, something went wrong.
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.
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'm wondering if we want to require setting workflow ID for Nexus operations. We require it in all Core based SDKs, maybe we can at least protect Nexus users. Not blocking this PR though. @cretz, @Quinn-With-Two-Ns to weigh in on this.
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 thought the Go SDK did require setting a workflow ID for Nexus operations? I think it makes sense to require it or at least default it to something deterministic so starting a workflow is idempotent
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, this was my intent but I think the client will automatically fill in an ID unless one is provided. Need to verify this.
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 require it meaning I don't need the check for it being empty here? I looked for where a default would be set but didn't find anything that would set it before this point.
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 change to ensure that the client doesn't auto generate an ID if one isn't set.
We should note this change in the release notes. I would consider it a backwards incompatible behavior change.
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.
@pdoerner this already changed for Java, please make sure to disallow empty workflow ID for nexus ops before merging this.