XACKDEL · Valkey

XACKDEL

Acknowledge and (if possible) delete stream message(s).

Usage

XACKDEL key group [KEEPREF | DELREF | ACKED] IDS numids id [id…]

Description

The XACKDEL command is an extension of the XACK stream command that acknowledges the specified message IDs in group’s pending entries list (PEL) and, depending on mode, deletes the underlying stream messages.

This is particularly useful when multiple consumer groups independently process the same stream and you need to reclaim space without deleting messages that another group still needs.

The command supports three deletion modes:

Reply

Array of integer codes, one per requested ID, in the same order as the IDs are given.

Complexity

O(1) for each single item to delete in the stream, regardless of the stream size

ACL Categories

@fast @stream @write

Examples

127.0.0.1:6899> XADD s5 * a 1
"1788350000000-0"
127.0.0.1:6899> XGROUP CREATE s5 g1 0
OK
127.0.0.1:6899> XGROUP CREATE s5 g2 0
OK
127.0.0.1:6899> XREADGROUP GROUP g1 cons1 COUNT 10 STREAMS s5 >
1) 1) "s5"
   2) 1) 1) "1788350000000-0"
         2) 1) "a"
            2) "1"
127.0.0.1:6899> XACKDEL s5 g1 ACKED IDS 1 1788350000000-0
1) (integer) 2
127.0.0.1:6899> XLEN s5
(integer) 1
127.0.0.1:6899> XREADGROUP GROUP g2 cons1 COUNT 10 STREAMS s5 >
1) 1) "s5"
   2) 1) 1) "1788350000000-0"
         2) 1) "a"
            2) "1"
127.0.0.1:6899> XACKDEL s5 g2 ACKED IDS 1 1788350000000-0
1) (integer) 1
127.0.0.1:6899> XLEN s5
(integer) 0

History

See also

XACK, XADD, XAUTOCLAIM, XCLAIM, XDEL, XDELEX, XGROUP, XGROUP CREATE, XGROUP CREATECONSUMER, XGROUP DELCONSUMER, XGROUP DESTROY, XGROUP HELP, XGROUP SETID, XINFO, XINFO CONSUMERS, XINFO GROUPS, XINFO HELP, XINFO STREAM, XLEN, XPENDING, XRANGE, XREAD, XREADGROUP, XREVRANGE, XSETID, XTRIM.