-
Notifications
You must be signed in to change notification settings - Fork 133
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 documentation for propagators and how they are executed #1312
Changes from 1 commit
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 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -36,8 +36,24 @@ type HeaderReader interface { | |||||||||
ForEachKey(handler func(string, []byte) error) error | ||||||||||
} | ||||||||||
|
||||||||||
// ContextPropagator is an interface that determines what information from | ||||||||||
// context to pass along | ||||||||||
// ContextPropagator determines what information from context to pass along. | ||||||||||
// | ||||||||||
// The information passed is called Headers - a sequence of string to []byte | ||||||||||
// tuples of serialized data that should follow workflow and activity execution | ||||||||||
// around. | ||||||||||
// | ||||||||||
// Inject* methods are used on the way from the process to persistence in | ||||||||||
// Cadence - thus they use HeaderWriter-s to write the metadata. Extract* | ||||||||||
// methods are used on the way from persisted state in Cadence to execution | ||||||||||
// - thus they use HeaderReader-s to read the metadata and fill it in the | ||||||||||
// returned context. Returning error from Extract* methods prevents the | ||||||||||
// successful workflow run. | ||||||||||
// | ||||||||||
// The whole sequence of execution is: | ||||||||||
// | ||||||||||
// Process initiating the workflow -> Inject -> Cadence -> Go Workflow Worker | ||||||||||
// -> ExtractToWorkflow -> Start executing a workflow -> InjectFromWorkflow -> | ||||||||||
// Cadence -> Go Activity Worker -> Extract -> Execute Activity | ||||||||||
Comment on lines
+55
to
+56
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: this might make it easier for users to understand
Suggested change
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. I think that it is out of the scope of the context propagator, so we might add it if it causes confusion. |
||||||||||
type ContextPropagator interface { | ||||||||||
// Inject injects information from a Go Context into headers | ||||||||||
Inject(context.Context, HeaderWriter) error | ||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,23 @@ type ( | |
// HeaderWriter is an interface to write information to cadence headers | ||
HeaderWriter = internal.HeaderWriter | ||
|
||
// ContextPropagator is an interface that determines what information from | ||
// context to pass along | ||
// ContextPropagator determines what information from context to pass along. | ||
// | ||
// The information passed is called Headers - a sequence of string to []byte | ||
// tuples of serialized data that should follow workflow and activity execution | ||
// around. | ||
// | ||
// Inject* methods are used on the way from the process to persistence in | ||
// Cadence - thus they use HeaderWriter-s to write the metadata. Extract* | ||
// methods are used on the way from persisted state in Cadence to execution | ||
// - thus they use HeaderReader-s to read the metadata and fill it in the | ||
// returned context. Returning error from Extract* methods prevents the | ||
// successful workflow run. | ||
// | ||
// The whole sequence of execution is: | ||
// | ||
// Process initiating the workflow -> Inject -> Cadence -> Go Workflow Worker | ||
// -> ExtractToWorkflow -> Start executing a workflow -> InjectFromWorkflow -> | ||
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. ditto |
||
// Cadence -> Go Activity Worker -> Extract -> Execute Activity | ||
ContextPropagator = internal.ContextPropagator | ||
) |
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.
thanks for filling in this documentation gap. @shijiesheng can you review please?