The XACKDEL command acknowledges and deletes stream entries atomically in a single operation. This is useful for consumer groups where you want to acknowledge message processing and remove the entries from the stream simultaneously.
Arguments#
The key of the stream.
The consumer group name.
Deletion behavior (case-insensitive). Must come before the IDs:
KEEPREF: Delete the entries but keep their references in other consumer groups’ pending listsDELREF: Delete the entries and remove their references from every consumer group’s pending listACKED: Only delete entries that every consumer group has acknowledged
One or more stream entry IDs to acknowledge and delete. When an option is provided, IDs must come after the option.
Response#
An array with one result per ID, in the same order as provided: 1 if the entry was deleted, -1 if it doesn’t exist, 2 if it was kept because ACKED was given and some consumer group hasn’t acknowledged it yet.
Use Cases#
- Message Queue Cleanup: Process messages and remove them from the stream in one operation
- Event Processing: Acknowledge event handling and clean up the stream
- Task Queue Management: Complete tasks and remove them atomically
- Memory Optimization: Reduce stream memory usage by removing processed entries
Comparison with XACK + XDEL#
Traditional approach (two operations):
With XACKDEL (single atomic operation):
This command is available in Redis 8.2.0 and later. It combines XACK and XDEL into a single atomic operation, which is more efficient and ensures consistency.