Skip to content

Commit 5220f1c

Browse files
maheshwariphyperlint-ai[bot]Oxyjun
authored
Pause and purge message delivery (#20284)
* Added commmands to pause and resume queue delivery * Added documentation to pause queues * Update src/content/docs/queues/configuration/pause-purge.mdx Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com> * Added documentation for purging * Updated purge command * Fixed typos * Improved language * Apply suggestions from code review * Update pause-purge.mdx * Update commands.mdx --------- Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com> Co-authored-by: Jun Lee <[email protected]>
1 parent 103e37b commit 5220f1c

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
title: Pause and Purge
3+
pcx_content_type: concept
4+
sidebar:
5+
order: 2
6+
---
7+
import { WranglerConfig, Type, MetaInfo } from "~/components";
8+
9+
## Pause Delivery
10+
11+
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.
12+
13+
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.
14+
15+
Pausing affects both [push-based consumer Workers](/queues/reference/how-queues-works#consumers) and [pull based consumers](/queues/configuration/pull-consumers).
16+
17+
### Pause and resume delivery using Wrangler
18+
19+
The following command will pause message delivery from your queue:
20+
21+
```sh
22+
$ npx run wrangler queues pause-delivery <QUEUE-NAME>
23+
```
24+
25+
- `queue-name` <Type text="string" /> <MetaInfo text="required" />
26+
- The name of the queue for which delivery should be paused.
27+
28+
The following command will resume message delivery:
29+
30+
```sh
31+
$ npx run wrangler queues resume-delivery <QUEUE-NAME>
32+
```
33+
34+
- `queue-name` <Type text="string" /> <MetaInfo text="required" />
35+
- The name of the queue for which delivery should be resumed.
36+
37+
### What happens to HTTP Pull consumers with a paused queue?
38+
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`.
39+
40+
## Purge queue
41+
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.
42+
43+
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.
44+
45+
:::caution
46+
Purging a queue is an irreversible operation. Make sure to use this operation carefully.
47+
:::
48+
49+
### Purge queue using Wrangler
50+
The following command will purge messages from your queue. You will be prompted to enter the queue name to confirm the operation.
51+
```sh
52+
$ npx run wrangler queues purge <QUEUE-NAME>
53+
54+
This operation will permanently delete all the messages in Queue <QUEUE-NAME>. Type <QUEUE-NAME> to proceed.
55+
```
56+
57+
### Does purging a Queue affect my bill?
58+
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.

src/content/docs/workers/wrangler/commands.mdx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,6 +1277,35 @@ wrangler queues consumer remove <queue-name> <script-name>
12771277

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

1280+
### `purge`
1281+
1282+
Permanently delete all messages in a queue.
1283+
1284+
```txt
1285+
wrangler queues purge <queue-name>
1286+
```
1287+
- `queue-name` <Type text="string" /> <MetaInfo text="required" />
1288+
- The name of the queue from which messages should be deleted.
1289+
1290+
### `pause-delivery`
1291+
1292+
Pause message delivery from a Queue to consumers (including push consumers, and HTTP pull consumers)
1293+
1294+
```txt
1295+
wrangler queues pause-delivery <queue-name>
1296+
```
1297+
- `queue-name` <Type text="string" /> <MetaInfo text="required" />
1298+
- The name of the queue which delivery should be paused.
1299+
1300+
### `resume-delivery`
1301+
1302+
Resume delivery from a Queue to consumers (including push consumers, and HTTP pull consumers)
1303+
```txt
1304+
wrangler queues resume-delivery <queue-name>
1305+
```
1306+
- `queue-name` <Type text="string" /> <MetaInfo text="required" />
1307+
- The name of the queue from which delivery should be resumed.
1308+
12801309
---
12811310

12821311
## `login`

0 commit comments

Comments
 (0)