-
Notifications
You must be signed in to change notification settings - Fork 141
Add documentation of interceptors to README #970
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
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -94,6 +94,7 @@ informal introduction to the features and their implementation. | |||||
| - [Heartbeating and Cancellation](#heartbeating-and-cancellation) | ||||||
| - [Worker Shutdown](#worker-shutdown) | ||||||
| - [Testing](#testing-1) | ||||||
| - [Interceptors](#interceptors) | ||||||
| - [Nexus](#nexus) | ||||||
| - [Workflow Replay](#workflow-replay) | ||||||
| - [Observability](#observability) | ||||||
|
|
@@ -1310,6 +1311,68 @@ affect calls activity code might make to functions on the `temporalio.activity` | |||||
| * `worker_shutdown()` can be invoked to simulate a worker shutdown during execution of the activity | ||||||
|
|
||||||
|
|
||||||
| ### Interceptors | ||||||
|
|
||||||
| The behavior of the SDK can be customized in many useful ways by modifying inbound and outbound calls using | ||||||
| interceptors. This is similar to the use of middleware in other frameworks. | ||||||
|
|
||||||
| There are five categories of inbound and outbound calls that you can modify in this way: | ||||||
|
|
||||||
| 1. Outbound client calls, such as `start_workflow()`, `signal_workflow()`, `list_workflows()`, `update_schedule()`, etc. | ||||||
|
|
||||||
| 2. Inbound workflow calls: `execute_workflow()`, `handle_signal()`, `handle_update_handler()`, etc | ||||||
|
|
||||||
| 3. Outbound workflow calls: `start_activity()`, `start_child_workflow()`, `start_nexus_operation()`, etc | ||||||
|
|
||||||
| 4. Inbound call to execute an activity: `execute_activity()` | ||||||
|
|
||||||
| 5. Outbound activity calls: `info()` and `hearbeat()` | ||||||
|
||||||
| 5. Outbound activity calls: `info()` and `hearbeat()` | |
| 5. Outbound activity calls: `info()` and `heartbeat()` |
Outdated
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.
pass a list containing an instance of your
worker.Interceptorclass as theinterceptorsargument ofClient.connect().
Only client interceptors should be passed to client connect. If it also implements worker interceptor, then that ends up applying to worker too, but you can't just pass worker interceptors to client connect.
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.
Ah thanks, yes that section wasn't quite there. I've pushed an update.
Outdated
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.
| You can also pass worker interceptors as the `interceptor` argument to the | |
| You can also pass worker interceptors as the `interceptors` argument to the |
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.
Ug, I just realized we called it
handle_update_handlerinstead ofhandle_updatehere, oh well too late to change nowThere 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.
That was a deliberate design decision -- to match
handle_update_validator(). Pretty sure you were involved in that decision.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 personally have preferred
handle_update()Uh oh!
There was an error while loading. Please reload this page.
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.
K, yeah I guess I regret my choice here if that is what happened. Luckily I didn't replicate it in .NET or Ruby.