Improve header serialization and propagation#124
Merged
antstorm merged 2 commits intocoinbase:masterfrom Dec 5, 2021
Merged
Conversation
antstorm
approved these changes
Dec 1, 2021
Contributor
antstorm
left a comment
There was a problem hiding this comment.
Looks great, thank you, @jeffschoner-stripe!
One note — do you think it's feasible to support the legacy behavior while adding a deprecation message?
You can probably switch on a class name, however it might not be worth it as I don't think there are lots of people who are dependent on it. Let me ask in Slack
Contributor
Author
|
I've added another commit for this back-compat. Feel free to merge it, or we can remove it if there's no need to support that. |
antstorm
approved these changes
Dec 5, 2021
Contributor
antstorm
left a comment
There was a problem hiding this comment.
Perfect, thank you @jeffschoner-stripe !
gvieira
pushed a commit
to clearbit/temporal-ruby
that referenced
this pull request
Dec 21, 2021
* Pass config to the error handler instead of using the global config * Fix example tests * Make the config property in the workflow context publicly readable * [Fix] Retryer GRPC error lookup (coinbase#109) * Fix issue with GRPC error lookup in Retryer * Rename spec file for retryer to contain _spec * [Feature] Add id and domain to workflow context's metadata (coinbase#110) * Start syncing id and domain on workflow context metadata * Fixed tests Co-authored-by: DeRauk Gibble <derauk.gibble@coinbase.com> * Explicit docker-compose project name (coinbase#114) * Add YARD documentation for Temporal::Client (coinbase#113) * Add YARD documentation for Temporal::Client * Add yard gem * Fix @option tag * Typo fix * Add signal arguments to start_workflow (support for signal_with_start) (coinbase#112) * Add signal arguments to start_workflow (to support signal_with_start) * Move signal arguments to the options hash * PR feedback * Fix merge error * Extend #wait_for to take multiple futures and a condition block (coinbase#111) * Differentiate TARGET_WILDCARD and WILDCARD, allow comparison with EventTarget objects (coinbase#118) * Turn off schedule_to_start activity timeout by default (coinbase#119) * Separate options from keyword args in #start_workflow (coinbase#117) * Separate options from keyword args in #start_workflow * fixup! Separate options from keyword args in #start_workflow * Surface additional workflow metadata on workflow context (coinbase#120) * Refactor metadata generation * Make task queue available on workflow metadata, add example test * Expose workflow start time metadata * Add memos (coinbase#121) * Add describe_namespace (coinbase#122) * Add describe_namespace * Feedback * Improve header serialization and propagation (coinbase#124) * [Fix] Non-started activity cancellation (coinbase#125) * Fix event target map entry for ACTIVITY_CANCELED event * Fix cancellation of a non-started activity * fixup! Fix event target map entry for ACTIVITY_CANCELED event Co-authored-by: DeRauk Gibble <derauk.gibble@coinbase.com> Co-authored-by: DeRauk Gibble <derauk@gmail.com> Co-authored-by: Anthony Dmitriyev <antstorm@gmail.com> Co-authored-by: nagl-stripe <86737162+nagl-stripe@users.noreply.github.com> Co-authored-by: jeffschoner-stripe <63118764+jeffschoner-stripe@users.noreply.github.com> Co-authored-by: Drew Hoskins <37816070+drewhoskins-stripe@users.noreply.github.com>
calum-stripe
pushed a commit
to calum-stripe/temporal-ruby
that referenced
this pull request
Mar 28, 2023
…kins_schedule Dynamic Workflows
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This contains two improvements to headers, both of which change the behavior of workflow headers:
First, headers are now by default propagated to the next run of a workflow on continue-as-new. This can be overridden by passing
options: {headers: overridden_headers}toworkflow.continue_as_newif desired.Second, to set headers, you no longer need to use the generated proto classes. Instead, you can simply pass an ordinary hash, which will be automatically serialized into the proper proto. This makes the use of headers more ergonomic and eliminates the need to use the lower-level protobuf abstraction in code that uses temporal-ruby. However, this is a breaking change. If you are currently passing protobuf objects in for headers, you will need to instead pass a hash.
Testing
The continue-as-new integration test will now check that headers are propagated to the next run, as it already did with memos. The metadata workflow test now passes headers in the new way.
Existing unit tests have been updated to work with passing an ordinary hash for headers: