-
Notifications
You must be signed in to change notification settings - Fork 230
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
Changes from 1 commit
30b6eac
6b0260f
eb6e759
a1cbd2d
0866c1b
1dccd59
bb25b69
df8d203
db5178e
9c8298f
39b623e
1679683
9437de3
2197e11
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,7 @@ | |
"context" | ||
"errors" | ||
|
||
"github.com/google/uuid" | ||
"github.com/nexus-rpc/sdk-go/nexus" | ||
"go.temporal.io/api/common/v1" | ||
"go.temporal.io/api/enums/v1" | ||
|
@@ -324,12 +325,21 @@ | |
if startWorkflowOptions.TaskQueue == "" { | ||
startWorkflowOptions.TaskQueue = nctx.TaskQueue | ||
} | ||
if startWorkflowOptions.ID == "" { | ||
startWorkflowOptions.ID = uuid.NewString() | ||
} | ||
|
||
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 { | ||
Check failure on line 340 in temporalnexus/operation.go
|
||
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 | ||
Check failure on line 341 in temporalnexus/operation.go
|
||
} | ||
internal.SetCallbacksOnStartWorkflowOptions(&startWorkflowOptions, []*common.Callback{ | ||
{ | ||
Variant: &common.Callback_Nexus_{ | ||
|
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.