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
Acknowledges and deletes one or multiple messages for a stream consumer group at the specified `key`.
82
+
Acknowledges and conditionally deletes one or multiple entries (messages) for a stream consumer group at the specified `key`.
83
83
84
-
`XACKDEL` combines the functionality of [`XACK`]({{< relref "/commands/xack" >}}) and [`XDEL`]({{< relref "/commands/xdel" >}}) in Redis Streams. It acknowledges the specified message IDs in the given consumer group and simultaneously attempts to delete the corresponding entries from the stream.
84
+
`XACKDEL` combines the functionality of [`XACK`]({{< relref "/commands/xack" >}}) and [`XDEL`]({{< relref "/commands/xdel" >}}) in Redis Streams. It acknowledges the specified entry IDs in the given consumer group and simultaneously attempts to delete the corresponding entries from the stream.
85
85
86
86
## Required arguments
87
87
@@ -110,14 +110,18 @@ The IDS block specifying which entries to acknowledge and delete:
Specifies how to handle consumer group references when acknowledging and deleting entries. Available since Redis 8.2.0. If no option is specified, `KEEPREF` is used by default:
113
+
Specifies how to handle consumer group references when acknowledging and deleting entries. Available since Redis 8.2. If no option is specified, `KEEPREF` is used by default:
114
114
115
-
-`KEEPREF` (default): Acknowledges the messages in the specified consumer group and deletes the entries from the stream, but preserves existing references to these entries in all consumer groups' PEL (Pending Entries List).
116
-
-`DELREF`: Acknowledges the messages in the specified consumer group, deletes the entries from the stream, and also removes all references to these entries from all consumer groups' pending entry lists, effectively cleaning up all traces of the messages.
117
-
-`ACKED`: Acknowledges the messages in the specified consumer group and only deletes entries that were read and acknowledged by all consumer groups.
115
+
-`KEEPREF` (default): Acknowledges the entries in the specified consumer group and deletes the entries from the stream, but preserves existing references to these entries in all consumer groups' PEL (Pending Entries List).
116
+
-`DELREF`: Acknowledges the entries in the specified consumer group, deletes the entries from the stream, and also removes all references to these entries from all consumer groups' pending entry lists, effectively cleaning up all traces of the entries. If an entry ID is not in the stream, but there are dangling references, `XACKDEL` with `DELREF` would still remove all those references.
117
+
-`ACKED`: Acknowledges the entries in the specified consumer group and only deletes entries that were read and acknowledged by all consumer groups.
118
118
</details>
119
119
120
-
This command is particularly useful when you want to both acknowledge message processing and clean up the stream in a single atomic operation, providing fine-grained control over how consumer group references are handled.
120
+
This command is particularly useful when you want to both acknowledge entry processing and clean up the stream in a single atomic operation, providing fine-grained control over how entry references are handled.
121
+
122
+
{{< note >}}
123
+
When using multiple consumer groups, users are encouraged to use `XACKDEL` with the `ACKED` option instead of `XACK` and `XDEL`, simplifying the application logic.
124
+
{{< /note >}}
121
125
122
126
## Examples
123
127
@@ -138,16 +142,22 @@ XRANGE mystream - +
138
142
tab1="RESP2"
139
143
tab2="RESP3" >}}
140
144
141
-
[Array reply](../../develop/reference/protocol-spec#arrays): For each ID:
142
-
*[Integer reply](../../develop/reference/protocol-spec#integers): -1 if no such ID exists in the provided stream key.
143
-
*[Integer reply](../../develop/reference/protocol-spec#integers): 1 if the entry was acknowledged and deleted from the stream.
144
-
*[Integer reply](../../develop/reference/protocol-spec#integers): 2 if the entry was acknowledged but not deleted, as there are still dangling references (ACKED option).
145
+
One of the following:
146
+
147
+
*[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): -1 for each requested ID when the given key does not exist.
148
+
*[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): For each ID:
149
+
*[Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): 1 if the entry was acknowledged and deleted from the stream.
150
+
*[Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): -1 if no such ID exists in the provided stream key.
151
+
*[Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): 2 if the entry was acknowledged but not deleted, as there are still dangling references (ACKED option).
145
152
146
153
-tab-sep-
147
154
148
-
[Array reply](../../develop/reference/protocol-spec#arrays): For each ID:
149
-
*[Integer reply](../../develop/reference/protocol-spec#integers): -1 if no such ID exists in the provided stream key.
150
-
*[Integer reply](../../develop/reference/protocol-spec#integers): 1 if the entry was acknowledged and deleted from the stream.
151
-
*[Integer reply](../../develop/reference/protocol-spec#integers): 2 if the entry was acknowledged but not deleted, as there are still dangling references (ACKED option).
155
+
One of the following:
156
+
157
+
*[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): -1 for each requested ID when the given key does not exist.
158
+
*[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): For each ID:
159
+
*[Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): 1 if the entry was acknowledged and deleted from the stream.
160
+
*[Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): -1 if no such ID exists in the provided stream key.
161
+
*[Integer reply]({{< relref "/develop/reference/protocol-spec#integers" >}}): 2 if the entry was acknowledged but not deleted, as there are still dangling references (ACKED option).
Specifies how to handle consumer group references when trimming. Available since Redis 8.2.0. If no option is specified, `KEEPREF` is used by default. Unlike the `XDELEX` and `XACKDEL` commands where one of these options is required, here they are optional to maintain backward compatibility:
178
+
Specifies how to handle consumer group references when trimming. Available since Redis 8.2. If no option is specified, `KEEPREF` is used by default. Unlike the `XDELEX` and `XACKDEL` commands where one of these options is required, here they are optional to maintain backward compatibility:
179
179
180
180
-`KEEPREF` (default): When trimming, removes entries from the stream according to the specified strategy (`MAXLEN` or `MINID`), regardless of whether they are referenced by any consumer groups, but preserves existing references to these entries in all consumer groups' PEL (Pending Entries List).
181
181
-`DELREF`: When trimming, removes entries from the stream according to the specified strategy and also removes all references to these entries from all consumer groups' PEL.
Specifies how to handle consumer group references when deleting entries. Available since Redis 8.2.0. If no option is specified, `KEEPREF` is used by default:
105
+
Specifies how to handle consumer group references when deleting entries. Available since Redis 8.2. If no option is specified, `KEEPREF` is used by default:
106
106
107
107
-`KEEPREF` (default): Deletes the specified entries from the stream, but preserves existing references to these entries in all consumer groups' PEL (Pending Entries List). This behavior is similar to [`XDEL`]({{< relref "/commands/xdel" >}}).
108
-
-`DELREF`: Deletes the specified entries from the stream and also removes all references to these entries from all consumer groups' pending entry lists, effectively cleaning up all traces of the messages.
108
+
-`DELREF`: Deletes the specified entries from the stream and also removes all references to these entries from all consumer groups' pending entry lists, effectively cleaning up all traces of the messages. If an entry ID is not in the stream, but there are dangling references, `XDELEX` with `DELREF` would still remove all those references.
109
109
-`ACKED`: Only deletes entries that were read and acknowledged by all consumer groups.
110
110
</details>
111
111
@@ -128,16 +128,22 @@ XRANGE mystream - +
128
128
tab1="RESP2"
129
129
tab2="RESP3" >}}
130
130
131
-
[Array reply](../../develop/reference/protocol-spec#arrays): For each ID:
132
-
*[Integer reply](../../develop/reference/protocol-spec#integers): -1 if no such ID exists in the provided stream key.
133
-
*[Integer reply](../../develop/reference/protocol-spec#integers): 1 if the entry was deleted from the stream.
134
-
*[Integer reply](../../develop/reference/protocol-spec#integers): 2 if the entry was not deleted, but there are still dangling references (ACKED option).
131
+
One of the following:
132
+
133
+
*[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): -1 for each requested ID when the given key does not exist.
134
+
*[Array reply](../../develop/reference/protocol-spec#arrays): For each ID:
135
+
*[Integer reply](../../develop/reference/protocol-spec#integers): -1 if no such ID exists in the provided stream key.
136
+
*[Integer reply](../../develop/reference/protocol-spec#integers): 1 if the entry was deleted from the stream.
137
+
*[Integer reply](../../develop/reference/protocol-spec#integers): 2 if the entry was not deleted, but there are still dangling references (ACKED option).
135
138
136
139
-tab-sep-
137
140
138
-
[Array reply](../../develop/reference/protocol-spec#arrays): For each ID:
139
-
*[Integer reply](../../develop/reference/protocol-spec#integers): -1 if no such ID exists in the provided stream key.
140
-
*[Integer reply](../../develop/reference/protocol-spec#integers): 1 if the entry was deleted from the stream.
141
-
*[Integer reply](../../develop/reference/protocol-spec#integers): 2 if the entry was not deleted, but there are still dangling references (ACKED option).
141
+
One of the following:
142
+
143
+
*[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}): -1 for each requested ID when the given key does not exist.
144
+
*[Array reply](../../develop/reference/protocol-spec#arrays): For each ID:
145
+
*[Integer reply](../../develop/reference/protocol-spec#integers): -1 if no such ID exists in the provided stream key.
146
+
*[Integer reply](../../develop/reference/protocol-spec#integers): 1 if the entry was deleted from the stream.
147
+
*[Integer reply](../../develop/reference/protocol-spec#integers): 2 if the entry was not deleted, but there are still dangling references (ACKED option).
Copy file name to clipboardExpand all lines: content/develop/data-types/streams.md
+3-6Lines changed: 3 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,9 +9,7 @@ categories:
9
9
- oss
10
10
- kubernetes
11
11
- clients
12
-
description: 'Introduction to Redis streams
13
-
14
-
'
12
+
description: Introduction to Redis streams
15
13
linkTitle: Streams
16
14
title: Redis Streams
17
15
weight: 60
@@ -28,20 +26,19 @@ Examples of Redis stream use cases include:
28
26
Redis generates a unique ID for each stream entry.
29
27
You can use these IDs to retrieve their associated entries later or to read and process all subsequent entries in the stream. Note that because these IDs are related to time, the ones shown here may vary and will be different from the IDs you see in your own Redis instance.
30
28
31
-
Redis streams support several trimming strategies (to prevent streams from growing unbounded) and more than one consumption strategy (see [`XREAD`]({{< relref "/commands/xread" >}}), [`XREADGROUP`]({{< relref "/commands/xreadgroup" >}}), and [`XRANGE`]({{< relref "/commands/xrange" >}})). Starting with Redis 8.2, enhanced commands provide fine-grained control over how stream operations interact with multiple consumer groups, simplifying the coordination of message processing across different applications.
29
+
Redis streams support several trimming strategies (to prevent streams from growing unbounded) and more than one consumption strategy (see [`XREAD`]({{< relref "/commands/xread" >}}), [`XREADGROUP`]({{< relref "/commands/xreadgroup" >}}), and [`XRANGE`]({{< relref "/commands/xrange" >}})). Starting with Redis 8.2, the `XACKDEL`, `XDELEX`, `XADD`, and `XTRIM` commands provide fine-grained control over how stream operations interact with multiple consumer groups, simplifying the coordination of message processing across different applications.
32
30
33
31
## Basic commands
32
+
34
33
*[`XADD`]({{< relref "/commands/xadd" >}}) adds a new entry to a stream.
35
34
*[`XREAD`]({{< relref "/commands/xread" >}}) reads one or more entries, starting at a given position and moving forward in time.
36
35
*[`XRANGE`]({{< relref "/commands/xrange" >}}) returns a range of entries between two supplied entry IDs.
37
36
*[`XLEN`]({{< relref "/commands/xlen" >}}) returns the length of a stream.
38
37
*[`XDEL`]({{< relref "/commands/xdel" >}}) removes entries from a stream.
39
-
*[`XDELEX`]({{< relref "/commands/xdelex" >}}) removes entries from a stream with enhanced control over consumer group references.
40
38
*[`XTRIM`]({{< relref "/commands/xtrim" >}}) trims a stream by removing older entries.
41
39
42
40
See the [complete list of stream commands]({{< relref "/commands/" >}}?group=stream).
43
41
44
-
45
42
## Examples
46
43
47
44
* When our racers pass a checkpoint, we add a stream entry for each racer that includes the racer's name, speed, position, and location ID:
0 commit comments