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/reference-architecture/diagrams/storage/event-notifications-for-storage.mdx
+10-6Lines changed: 10 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,13 +6,15 @@ products:
6
6
sidebar:
7
7
order: 1
8
8
label: Event notifications for storage
9
-
updated: 2024-10-18
9
+
updated: 2024-10-21
10
10
---
11
11
12
12
## Introduction
13
13
14
14
Cloudflare [R2](/r2/) Storage allows developers to store large amounts of unstructured data without the costly egress bandwidth fees associated with typical cloud storage services. The lifecycle of data in object storage often extends beyond uploading, modifying, or deleting the data. There may be a requirement to transform, analyze, or perform post-processing on the data. R2 provides [event notifications](/r2/buckets/event-notifications/) to manage these event-driven workflows.
15
15
16
+
This document walks through how to use our built in serverless [Cloudflare Workers](/workers/) or an external service to monitor for notifications about data changes and then handle them appropriately.
17
+
16
18
## Push-based consumer Worker
17
19
18
20
Event notifications function by sending messages to a [queue](/queues/) whenever there is a change to your data. These messages are then handled by a [consumer Worker](/queues/reference/how-queues-works/#consumers). A consumer Worker is the term for a client that is subscribing to or consuming messages from a queue. The consumer Worker will automatically receive these messages, allowing you to define any subsequent actions that need to be taken.
@@ -30,7 +32,7 @@ Consider the example below of push-based post-processing: when a user uploads a
30
32
31
33
## Pull-based HTTP consumer
32
34
33
-
Alternatively, you can establish a [pull-based consumer](/queues/configuration/pull-consumers/), where you pull from a queue over HTTP from any environment. Use a pull-based consumer if you need to consume messages from existing infrastructure outside of Cloudflare Workers, and/or where you need to carefully control how fast messages are consumed.
35
+
Alternatively, you can establish a [pull-based consumer](/queues/configuration/pull-consumers/), where you pull from a queue over HTTP from any environment. Use a pull-based consumer if you need to consume messages from existing infrastructure outside of Cloudflare where you need to carefully control how fast messages are consumed.
34
36
35
37
A pull-based consumer must explicitly make a call to pull (and then acknowledge) messages from the queue, only when it is ready to do so.
36
38
@@ -40,13 +42,15 @@ Consider the scenario below: A user initiates a delete from R2. An external serv
40
42
41
43
1. A user initiates a delete from R2
42
44
2. An event notification is sent to the queue.
43
-
3. The external service, when ready, makes an HTTP POST request to the queue to pull the message
44
-
4. The queue sends the message
45
+
3. The external service, when ready to process the request, makes an HTTP POST request to the queue to pull the message
46
+
4. The queue sends the message in response to the POST request from step 3.
45
47
5. The external service must acknowledge that the message has been received
46
48
47
-
## Additional Example Use Cases:
49
+
You can follow the steps here to [configure a pull-based consumer](/queues/configuration/pull-consumers/#1-enable-http-pull).
50
+
51
+
## Additional Example Use Cases
48
52
49
-
- Send an email to an administrator anytime objects are deleted from R2
53
+
- Send an email to an administrator anytime objects are deleted from R2.
50
54
- When a video or podcast is uploaded to R2, it automatically processes the content using one of Cloudflare's Automatic Speech Recognition (ASR) AI models to generate subtitles or even translate the content.
51
55
- Remove related database entries if an object in R2 is deleted.
0 commit comments