Skip to content

Commit 097e4ca

Browse files
committed
hidden: true
1 parent b0b0e87 commit 097e4ca

File tree

4 files changed

+30
-14
lines changed

4 files changed

+30
-14
lines changed

src/content/changelog/workflows/2025-04-07-workflows-ga.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ description: Workflows is now GA - ship Workflows that you can rely on in produc
44
- workflows
55
- workers
66
date: 2025-04-07T13:00:00Z
7+
hidden: true
78
---
89

910
import { Render, PackageManagers, TypeScriptExample } from "~/components"

src/content/docs/workflows/build/events-and-parameters.mdx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ When a Workflow is triggered, it can receive an optional event. This event can i
1212

1313
Events are a powerful part of a Workflow, as you often want a Workflow to act on data. Because a given Workflow instance executes durably, events are a useful way to provide a Workflow with data that should be immutable (not changing) and/or represents data the Workflow needs to operate on at that point in time.
1414

15-
## Pass parameters to a Workflow
15+
## Pass data to a Workflow
1616

1717
You can pass parameters to a Workflow in three ways:
1818

1919
* As an optional argument to the `create` method on a [Workflow binding](/workers/wrangler/commands/#trigger) when triggering a Workflow from a Worker.
2020
* Via the `--params` flag when using the `wrangler` CLI to trigger a Workflow.
21-
* Via the `step.waitForEvent` API, which allows a Workflow instance to wait for an event (and optional data) to be received while it is running.
21+
* Via the `step.waitForEvent` API, which allows a Workflow instance to wait for an event (and optional data) to be received _while it is running_.
2222

2323
You can pass any JSON-serializable object as a parameter.
2424

@@ -67,7 +67,25 @@ npx wrangler@latest workflows trigger workflows-starter '{"some":"data"}'
6767

6868
### Wait for events
6969

70-
A running Workflow can wait for an event (or events) by calling `step.waitForEvent`.
70+
A running Workflow can wait for an event (or events) by calling `step.waitForEvent` within the Workflow.
71+
72+
<TypeScriptExample>
73+
74+
```ts
75+
export class MyWorkflow extends WorkflowEntrypoint<Env, Params> {
76+
async run(event: WorkflowEvent<Params>, step: WorkflowStep) {
77+
// TODO
78+
//
79+
// TODO
80+
}
81+
}
82+
```
83+
84+
</TypeScriptExample>
85+
86+
### Sending events to running workflows
87+
88+
TODO
7189

7290
<TypeScriptExample>
7391

@@ -83,7 +101,6 @@ export class MyWorkflow extends WorkflowEntrypoint<Env, Params> {
83101

84102
</TypeScriptExample>
85103

86-
Visit the [guide on sending data to Workflows] to learn about how to pass event data to a running Workflow, including via HTTP (webhooks) and/or Workers bindings.
87104

88105
## TypeScript and type parameters
89106

src/content/docs/workflows/build/send-data-to-workflows.mdx

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/content/docs/workflows/build/workers-api.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,14 @@ More information about the limits imposed on Workflow can be found in the [Workf
107107

108108
:::
109109

110+
* <code>step.waitForEvent(name: string, options: ): Promise&lt;void&gt;</code>
111+
112+
* `name` - the name of the step.
113+
* `options` - an object with properties for `type`, which determines which event type this `waitForEvent` call will match on when calling `instance.sendEvent`, and an optional `timeout` property, which defines how long the `waitForEvent` call will block for before throwing a timeout exception. The default timeout is 24 hours.
114+
115+
Review the documentation on [events and parameters](/workflows/build/events-and-parameters/) to learn how to send events to a running Workflow instance.
116+
117+
110118
## WorkflowStepConfig
111119

112120
```ts

0 commit comments

Comments
 (0)