XACKDEL key group [KEEPREF | DELREF | ACKED] IDS numids id [id ...]
@write,
@stream,
@fast,
Acknowledges and conditionally deletes one or multiple entries (messages) for a stream consumer group at the specified key.
XACKDEL combines the functionality of XACK and 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.
keyThe name of the stream key.
groupThe name of the consumer group.
IDS numids id [id ...]The IDS block specifying which entries to acknowledge and delete:
numids: The number of IDs that followid [id ...]: One or more stream entry IDs to acknowledge and deleteKEEPREF | DELREF | ACKEDSpecifies 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:
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).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.ACKED: Acknowledges the entries in the specified consumer group and only deletes entries that were read and acknowledged by all consumer groups.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.
XACKDEL with the ACKED option instead of XACK and XDEL, simplifying the application logic.> XADD mystream * field1 value1
"1755870377536-0"
> XADD mystream * field2 value2
"1755870387045-0"
> XGROUP CREATE mystream mygroup 0
OK
> XREADGROUP GROUP mygroup consumer1 COUNT 2 STREAMS mystream >
1) 1) "mystream"
2) 1) 1) "1755870377536-0"
2) 1) "field1"
2) "value1"
2) 1) "1755870387045-0"
2) 1) "field2"
2) "value2"
> XPENDING mystream mygroup
1) (integer) 2
2) "1755870377536-0"
3) "1755870387045-0"
4) 1) 1) "consumer1"
2) "2"
> XACKDEL mystream mygroup KEEPREF IDS 2 1755870377536-0 1755870387045-0
1) (integer) 1
2) (integer) 1
> XPENDING mystream mygroup
1) (integer) 0
2) (nil)
3) (nil)
4) (nil)
> XRANGE mystream - +
(empty array)
| Redis Enterprise |
Redis Cloud |
Notes |
|---|---|---|
| ✅ Standard ✅ Active-Active |
✅ Standard ✅ Active-Active |
One of the following: