You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/workflows/get-started/cli-quick-start.mdx
+7-8Lines changed: 7 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ To learn more about Workflows, read [the beta announcement blog](https://blog.cl
19
19
20
20
Workflows allow you to build durable, multi-step applications using the Workers platform. A Workflow can automatically retry, persist state, run for hours or days, and coordinate between third-party APIs.
21
21
22
-
You can build Workflows to post-process file uploads to [R2 object storage](/r2/), automate generation of [Workers AI](/workers-ai/) embeddings into a [Vectorize](/vectorize/) vector database, or to trigger [user lifecycle emails](TODO) using your favorite email API.
22
+
You can build Workflows to post-process file uploads to [R2 object storage](/r2/), automate generation of [Workers AI](/workers-ai/) embeddings into a [Vectorize](/vectorize/) vector database, or to trigger user lifecycle emails using your favorite email API.
23
23
24
24
## Prerequisites
25
25
@@ -150,14 +150,11 @@ Specifically, the code above:
150
150
151
151
## 2. Deploy a Workflow
152
152
153
-
Workflows are deployed via [`wrangler](/workers/wrangler/install-and-update/), which is installed when you first ran `npm create cloudflare`, above. Workflows are Workers scripts, and deployed the same way.
153
+
Workflows are deployed via [`wrangler](/workers/wrangler/install-and-update/), which is installed when you first ran `npm create cloudflare`, above. Workflows are Workers scripts, and deployed the same way:
154
154
155
155
```sh
156
156
npx wrangler@latest deploy
157
157
```
158
-
```sh output
159
-
TODO
160
-
```
161
158
162
159
## 3. Running a Workflow
163
160
@@ -174,7 +171,9 @@ Refer to the [events and parameters documentation](/workflows/build/events-and-p
174
171
175
172
### Worker binding
176
173
177
-
TODO - trigger from a Worker
174
+
You can [bind to a Workflow](/workers/runtime-apis/bindings/#what-is-a-binding) from any handler in a Workers script, allowing you to programatically trigger and pass parameters to a Workflow instance from your own application code.
175
+
176
+
To bind a Workflow to a Worker, you need to define a `[[workflows]]` binding in your `wrangler.toml` configuration:
178
177
179
178
```toml title="wrangler.toml"
180
179
[[workflows]]
@@ -189,10 +188,10 @@ class_name = "MyWorkflow"
189
188
script_name = "workflows-starter"
190
189
```
191
190
192
-
You can then invoke the methods on this binding directly from your Worker script. The `Workflow` type has methods for:
191
+
You can then invoke the methods on this binding directly from your Worker script's `env` parameter. The `Workflow` type has methods for:
193
192
194
193
*`create()` - creating (triggering) a new instance of the Workflow, returning the ID.
195
-
*`get(id)`- retrieve a Workflow instance by ID
194
+
*`getByName()`- retrieve a Workflow instance by name (or `getById` by ID)
196
195
*`status()` - get the current status of a unique Workflow instance.
197
196
198
197
For example, the following Worker will fetch the status of an existing Workflow instance by ID (if supplied), else it will create a new Workflow instance and return its ID:
0 commit comments