-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CHASM workflow command handler for Nexus #9109
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
base: nexus/hsm-to-chasm-migration
Are you sure you want to change the base?
CHASM workflow command handler for Nexus #9109
Conversation
0225b74 to
15b2305
Compare
| return []*chasm.RegistrableComponent{ | ||
| chasm.NewRegistrableComponent[*Operation]("operation"), | ||
| chasm.NewRegistrableComponent[*Operation]("cancellation"), | ||
| chasm.NewRegistrableComponent[*Cancellation]("cancellation"), |
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.
Right?
5521052 to
125a6f1
Compare
3d0f476 to
cfe0179
Compare
| Callbacks chasm.Map[string, *callback.Callback] | ||
|
|
||
| // Operations map is used to store the nexus operations for the workflow. | ||
| Operations chasm.Map[string, *nexusoperation.Operation] |
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.
Not used yet, but demonstrates why command registry and types need to live in submodule. If they didn't there'd be an import cycle. Having this already ensures this design will work.
ceadf56 to
69632f8
Compare
|
|
||
| // FailWorkflowTaskError is an error that can be returned from a [CommandHandler] to fail the current workflow task and | ||
| // optionally terminate the entire workflow. | ||
| type FailWorkflowTaskError struct { |
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.
Moving this to CHASM now to break up import cycle.
| } | ||
|
|
||
| // CommandValidator is a helper for validating workflow commands. | ||
| type CommandValidator interface { |
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.
Moved to CHASM, too. More from this package might be moved in follow-up PRs.
49c85f6 to
3dca870
Compare
| // Logger returns a logger tagged with execution key and other chasm framework internal information. | ||
| Logger() log.Logger | ||
| // Library returns a registered library by name. | ||
| Library(name string) (Library, bool) |
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 had to add this to be able to access the Workflow library to get the command registry. Let me know if this is in line with the CHASM design!
bf830b5 to
b6d0074
Compare
| ctx chasm.MutableContext, | ||
| msPointer chasm.MSPointer, | ||
| ) *Workflow { | ||
| lib, ok := ctx.Library(chasm.WorkflowLibraryName) |
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 think it's fair to assume that this is always registered.
b6d0074 to
920f1f3
Compare
| ) error { | ||
| // TODO: Implement CHASM nexus operation cancellation | ||
| return serviceerror.NewUnimplemented("CHASM nexus operation cancellation not yet implemented") | ||
| } |
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.
My understanding is that we also want to support standalone Nexus operations, and this here might tie this module to workflows too tightly - so we could move all this into chasm/lib/nexusoperation/nexusworkflow (now or later) to make that distinction clearer.
| deps.Config, | ||
| ) | ||
| }), | ||
| ) |
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.
Copilot suggested moving the initialization from Nexus' fx to here; which made sense to me because of standalone Nexus operations. Having said that, this is also awkward in scenarios like Matching where there is no Nexus (hence the optional deps). Happy to discuss!
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.
(new thought; could move this bit and the command code both into chasm/lib/nexusoperation/nexusworkflow together)
What changed?
Why?
Migrating Nexus from HSM to CHASM.
How did you test it?
Tests will be ported over once actual command handler implementations are added.