Skip to content
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
58 changes: 58 additions & 0 deletions src/content/docs/queues/configuration/pause-purge.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
title: Pause and Purge
pcx_content_type: concept
sidebar:
order: 2
---
import { WranglerConfig, Type, MetaInfo } from "~/components";

## Pause Delivery

You can pause delivery of messages from your queue to any connected consumers. Pausing a queue is useful when managing downtime (for example, if your consumer Worker is unhealthy) without losing any messages.

Queues continue to receive and store messages even while delivery is paused. Messages in a paused queue are still subject to expiry, if the messages become older than the queue message retention period.

Pausing affects both [push-based consumer Workers](/queues/reference/how-queues-works#consumers) and [pull based consumers](/queues/configuration/pull-consumers).

### Pause and resume delivery using Wrangler

The following command will pause message delivery from your queue:

```sh
$ npx run wrangler queues pause-delivery <QUEUE-NAME>
```

- `queue-name` <Type text="string" /> <MetaInfo text="required" />
- The name of the queue for which delivery should be paused.

The following command will resume message delivery:

```sh
$ npx run wrangler queues resume-delivery <QUEUE-NAME>
```

- `queue-name` <Type text="string" /> <MetaInfo text="required" />
- The name of the queue for which delivery should be resumed.

### What happens to HTTP Pull consumers with a paused queue?
When a queue is paused, messages cannot be pulled by an [HTTP pull based consumer](/queues/configuration/pull-consumers). Requests to pull messages will receive a `409` response, along with an error message stating `queue_delivery_paused`.

## Purge queue
Purging a queue permanently deletes any messages currently stored in the Queue. Purging is useful while developing a new application, especially to clear out any test data. It can also be useful in production to handle scenarios when a batch of bad messages have been sent to a Queue.

Note that any in flight messages, which are currently being processed by consumers, might still be processed. Messages sent to a queue during a purge operation might not be purged. Any delayed messages will also be deleted from the queue.

:::caution
Purging a queue is an irreversible operation. Make sure to use this operation carefully.
:::

### Purge queue using Wrangler
The following command will purge messages from your queue. You will be prompted to enter the queue name to confirm the operation.
```sh
$ npx run wrangler queues purge <QUEUE-NAME>

This operation will permanently delete all the messages in Queue <QUEUE-NAME>. Type <QUEUE-NAME> to proceed.
```

### Does purging a Queue affect my bill?
Purging a queue counts as a single billable operation, regardless of how many messages are deleted. For example, if you purge a queue which has 100 messages, all 100 messages will be permanently deleted, and you will be billed for 1 billable operation. Refer to the [pricing](/queues/platform/pricing) page for more information about how Queues is billed.
29 changes: 29 additions & 0 deletions src/content/docs/workers/wrangler/commands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1348,6 +1348,35 @@ wrangler queues consumer remove <queue-name> <script-name>

<Render file="wrangler-commands/global-flags" product="workers" />

### `purge`

Permanently delete all messages in a queue.

```txt
wrangler queues purge <queue-name>
```
- `queue-name` <Type text="string" /> <MetaInfo text="required" />
- The name of the queue from which messages should be deleted.

### `pause-delivery`

Pause message delivery from a Queue to consumers (including push consumers, and HTTP pull consumers)

```txt
wrangler queues pause-delivery <queue-name>
```
- `queue-name` <Type text="string" /> <MetaInfo text="required" />
- The name of the queue which delivery should be paused.

### `resume-delivery`

Resume delivery from a Queue to consumers (including push consumers, and HTTP pull consumers)
```txt
wrangler queues resume-delivery <queue-name>
```
- `queue-name` <Type text="string" /> <MetaInfo text="required" />
- The name of the queue from which delivery should be resumed.

---

## `login`
Expand Down