Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to event notifications docs #17035

Merged
merged 2 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions src/content/docs/r2/buckets/event-notifications.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ pcx_content_type: how-to

Event notifications send messages to your [queue](/queues/) when data in your R2 bucket changes. You can consume these messages with a [consumer Worker](/queues/reference/how-queues-works/#create-a-consumer-worker) or [pull over HTTP](/queues/configuration/pull-consumers/) from outside of Cloudflare Workers.

:::note[Open Beta]

The event notifications feature is currently in open beta. To report bugs or request features, go to the #r2-storage channel in the [Cloudflare Developer Discord](https://discord.cloudflare.com) or fill out the [feedback form](https://forms.gle/2HBKD9zG9PFiU4v79).

:::

## Get started with event notifications
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you feel about deleting this header and then making Prerequisites, and the two headers that follow, an H2 instead?


### Prerequisites
Expand All @@ -21,13 +15,23 @@ Before getting started, you will need:
- An existing queue. If you do not already have a queue, refer to [Create a queue](/queues/get-started/#3-create-a-queue).
- A [consumer Worker](/queues/reference/how-queues-works/#create-a-consumer-worker) or [HTTP pull](/queues/configuration/pull-consumers/) enabled on your Queue.

### Set up Wrangler
### Enable event notifications via Dashboard

1. From the Cloudflare dashboard, select **R2** from the sidebar.
2. Select the bucket you'd like to add an event notification rule to.
3. Switch to the **Settings** tab, then scroll down to the **Event notifications** card.
4. Select **Add notification** and choose the queue you'd like to receive notifications and the [type of events](/r2/buckets/event-notifications/#event-types) that will trigger them.
5. Select **Add notification**.

To begin, refer to [Install/Update Wrangler](/workers/wrangler/install-and-update/#install-wrangler) to install Wrangler, the Cloudflare Developer Platform CLI. Log into Wrangler with the [`wrangler login` command](/workers/wrangler/commands/#login).
### Enable event notifications via Wrangler

### Enable event notifications on your R2 bucket
#### Set up Wrangler

To enable event notifications, add an event notification rule to your bucket by running the [`r2 bucket notification create` command](/workers/wrangler/commands/#notification-create). Event notification rules determine the [event types](/r2/buckets/event-notifications/#event-types) that trigger notifications and enable filtering based on object `prefix` and `suffix`.
To begin, install [`npm`](https://docs.npmjs.com/getting-started). Then [install Wrangler, the Developer Platform CLI](/workers/wrangler/install-and-update/).

#### Enable event notifications on your R2 bucket

Log in to Wrangler with the [`wrangler login` command](/workers/wrangler/commands/#login). Then add an [event notification rule](/r2/buckets/event-notifications/#event-notification-rules) to your bucket by running the [`r2 bucket notification create` command](/workers/wrangler/commands/#notification-create).

```sh
npx wrangler r2 bucket notification create <BUCKET_NAME> --event-type <EVENT_TYPE> --queue <QUEUE_NAME>
Expand All @@ -48,6 +52,10 @@ $ npx wrangler r2 bucket notification create <BUCKET_NAME> --event-type <EVENT_T

For a more complete step-by-step example, refer to the [Log and store upload events in R2 with event notifications](/r2/examples/upload-logs-event-notifications/) example.

## Event notification rules

Event notification rules determine the [event types](/r2/buckets/event-notifications/#event-types) that trigger notifications and optionally enable filtering based on object `prefix` and `suffix`. You can have up to 100 event notification rules per R2 bucket.

## Event types

<table>
Expand Down Expand Up @@ -81,18 +89,15 @@ For a more complete step-by-step example, refer to the [Log and store upload eve
<td>
<code>object-delete</code>
</td>
<td>
Triggered when an object is explicitly removed from the bucket.
<br />
<br />
<b>Note</b>: During the beta, deletes that occur as a result of object
lifecycle policies will not trigger this event.
</td>
<td>Triggered when an object is explicitly removed from the bucket.</td>
<td>
<ul>
<li>
<code>DeleteObject</code>
</li>
<li>
<code>LifecycleDeletion</code>
</li>
</ul>
</td>
</tr>
Expand Down Expand Up @@ -224,12 +229,7 @@ Queue consumers receive notifications as [Messages](/queues/configuration/javasc
</tbody>
</table>

## Limitations

During the beta, event notifications has the following limitations:
## Notes

- Queues [per-queue message throughput](/queues/platform/limits/) is currently 400 messages per second. If your workload produces more than 400 notifications per second, messages may be dropped.
- For a given bucket, only one event notification rule can be created per queue.
- Each bucket can have up to 5 event notification rules.
- Deletes that occur as a result of object lifecycle policies will not trigger an event notification.
- Event notifications are not available for buckets with [jursdictional restrictions](/r2/reference/data-location/#jurisdictional-restrictions).
- Event notifications are not available for buckets with [jursdictional restrictions](/r2/reference/data-location/#jurisdictional-restrictions) (_coming soon_).
- Queues [per-queue message throughput](/queues/platform/limits/) is currently 5,000 messages per second. If your workload produces more than 5,000 notifications per second, we recommend splitting notification rules across multiple queues.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there something in the Queues docs that shows you how to do this, that we should link to?

10 changes: 0 additions & 10 deletions src/content/docs/workers/wrangler/commands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -938,11 +938,6 @@ wrangler r2 bucket list

### `notification create`

:::note

Event notifications is currently in beta. To report bugs or request features, fill out the [Cloudflare R2 event notification feedback form](https://forms.gle/2HBKD9zG9PFiU4v79).
:::

Create an [event notification](/r2/buckets/event-notifications/) rule for an R2 bucket.

```txt
Expand Down Expand Up @@ -988,11 +983,6 @@ wrangler r2 bucket notification list <NAME>

### `sippy enable`

:::note

Sippy is currently in beta. To report bugs or request features, fill out the [Cloudflare R2 incremental migration feedback form](https://forms.gle/7WuCsbu5LmWkQVu76).
:::

Enable [Sippy](/r2/data-migration/sippy/) incremental migration for a bucket.

```txt
Expand Down
Loading