Skip to content

Commit 72381fc

Browse files
committed
improved worker binding documentation
1 parent 4afaa0e commit 72381fc

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/content/docs/pipelines/sources/worker-bindings.md renamed to src/content/docs/pipelines/sources/Workers.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
---
2-
title: Worker Bindings
2+
title: Workers
33
pcx_content_type: concept
44
sidebar:
55
order: 2
66
---
77

88
import { Render, PackageManagers } from "~/components"
99

10+
# Send records from a Worker
11+
1012
You can send records to your Pipeline directly from a [Cloudflare Worker](/workers/). To do so, you need to:
1113
1. Create a Worker
1214
2. Create a Pipeline
1315
3. Add your Pipeline as a binding in your Workers' `wrangler.toml` file
1416
4. Write your Worker, to send records to your Pipeline
17+
5. Deploy your Worker
18+
6. Verify in R2
1519

1620
## 1. Create a Worker
1721
Create a Cloudflare Worker if you don't alreadyåhave one. This Worker will send records to your Pipeline.
@@ -41,7 +45,7 @@ cd pipeline-worker
4145
```
4246

4347
## 2. Create a Pipeline
44-
Create a new Pipeline, if you don't already have one. Follow the instructions in the (get started guide)[pipelines/get-started] if this is your first time creating a Pipeline.
48+
Create a new Pipeline, if you don't already have one. If this is your first time using Pipelines, follow the instructions in the [get started guide](pipelines/get-started).
4549

4650
By default, Worker bindings are enabled on all Pipelines. Keep track of the name you gave your Pipeline in this stage; we'll use it in the next step.
4751

@@ -88,7 +92,7 @@ Replace `MY_PIPELINE` with the name of the binding you set in Step 3. If sending
8892

8993
In a production application, you would likely use a [`try...catch`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch) statement to catch the exception and handle it directly (for example, return a custom error or even retry).
9094

91-
### Publish your Worker
95+
## 5. Publish your Worker
9296
With your `wrangler.toml` file and `index.ts` file configured, you are ready to publish your producer Worker. To publish your producer Worker, run:
9397

9498
```sh
@@ -105,5 +109,8 @@ Published <YOUR-WORKER-NAME> (0.29 sec)
105109

106110
Copy your `*.workers.dev` subdomain and paste it into a new browser tab. Refresh the page a few times to send records to your Pipeline. Your browser should return the `Success` response after sending the record to your Pipeline.
107111

108-
## 5. Verify in R2
112+
## 6. Verify in R2
109113
Go to the R2 bucket you created in step 2 via [the Cloudflare dashboard](https://dash.cloudflare.com/). You should see a prefix for today's date. Click through, and you'll find one or more files, containing the records you sent in step 4.
114+
115+
# Local Development
116+
When running your Worker locally, sending data to your Pipeline will return a successful response. However, the data will not actually be sent to a Pipeline.

0 commit comments

Comments
 (0)