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/pipelines/sources/Workers.md
+11-4Lines changed: 11 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,21 @@
1
1
---
2
-
title: Worker Bindings
2
+
title: Workers
3
3
pcx_content_type: concept
4
4
sidebar:
5
5
order: 2
6
6
---
7
7
8
8
import { Render, PackageManagers } from "~/components"
9
9
10
+
# Send records from a Worker
11
+
10
12
You can send records to your Pipeline directly from a [Cloudflare Worker](/workers/). To do so, you need to:
11
13
1. Create a Worker
12
14
2. Create a Pipeline
13
15
3. Add your Pipeline as a binding in your Workers' `wrangler.toml` file
14
16
4. Write your Worker, to send records to your Pipeline
17
+
5. Deploy your Worker
18
+
6. Verify in R2
15
19
16
20
## 1. Create a Worker
17
21
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
41
45
```
42
46
43
47
## 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).
45
49
46
50
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.
47
51
@@ -88,7 +92,7 @@ Replace `MY_PIPELINE` with the name of the binding you set in Step 3. If sending
88
92
89
93
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).
90
94
91
-
###Publish your Worker
95
+
##5. Publish your Worker
92
96
With your `wrangler.toml` file and `index.ts` file configured, you are ready to publish your producer Worker. To publish your producer Worker, run:
93
97
94
98
```sh
@@ -105,5 +109,8 @@ Published <YOUR-WORKER-NAME> (0.29 sec)
105
109
106
110
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.
107
111
108
-
## 5. Verify in R2
112
+
## 6. Verify in R2
109
113
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