Skip to content
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

Workflow-init support docs (Typescript) #3107

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/develop/typescript/message-passing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ wf.setHandler(
This includes the Update ID, which can be useful for deduplication when using Continue-As-New: see [Ensuring your messages are processed exactly once](/encyclopedia/workflow-message-passing#exactly-once-message-processing).
- Update (and Signal) handlers can be `async`, letting them use Activities, Child Workflows, durable [`workflow.sleep`](https://typescript.temporal.io/api/namespaces/workflow#sleep) Timers, [`workflow.condition`](https://typescript.temporal.io/api/namespaces/workflow#condition) conditions, and more.
See [Async handlers](#async-handlers) and [Workflow message passing](/encyclopedia/workflow-message-passing) for safe usage guidelines.
- Delay calling [`workflow.setHandler`](https://typescript.temporal.io/api/namespaces/workflow#sethandler) until the workflow initialization needed by Update (or Signal) handlers has finished. This is safe because the SDK buffers messages when there are no registered handlers for them. Note that [`workflow.setHandler`](https://typescript.temporal.io/api/namespaces/workflow#sethandler) will immediately invoke the handler of buffered Updates (or Signals) with matching types, and this could lead to out-of-order processing of messages with different types.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the message-passing docs are an appropriate location for this. (The feature is only there for message handling reasons, and the Workflow Definition docs don't obviously to have an appropriate point for an "advanced usage" bullet point like this.)

However, since this feature applies to Update and Signal I wonder whether it should be placed in the "Message handler patterns" section, rather than in the Update section.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you see in the previous bullet it already talks about "Update (and Signal) handlers can be...", and most of the discussion in that bigger paragraph on async belongs to both.
I don't think it belongs in a "Message handler patterns" this is a bit more general than specific patterns. I agree that maybe we want to have a foundation section for both Update and Signal, but this PR was not trying to do that...
Maybe restructure the whole section in a different PR?


## Send messages {#send-messages}

Expand Down