0
0
Redisquery~10 mins

XACK for acknowledging messages in Redis - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - XACK for acknowledging messages
Consumer reads message from stream
Process message
Send XACK command with stream, group, message ID
Redis marks message as acknowledged
Message removed from pending list
Consumer can receive next message
The consumer reads a message, processes it, then sends XACK to Redis to mark it acknowledged, removing it from the pending list.
Execution Sample
Redis
XACK mystream mygroup 1609459200000-0
Acknowledges the message with ID 1609459200000-0 in group 'mygroup' on stream 'mystream'.
Execution Table
StepActionInputRedis ResponseEffect
1Consumer reads messageRead message ID 1609459200000-0Message deliveredMessage moved to pending list
2Consumer processes messageProcess message dataN/AMessage still pending
3Consumer sends XACKXACK mystream mygroup 1609459200000-01Message removed from pending list
4Consumer ready for next messageN/ANext message availableConsumer can read next message
💡 Message acknowledged and removed from pending list, so no longer pending.
Variable Tracker
VariableStartAfter Step 1After Step 2After Step 3Final
pending_listemptycontains 1609459200000-0contains 1609459200000-0emptyempty
message_statusunreadpendingprocessingacknowledgedacknowledged
Key Moments - 2 Insights
Why does the message stay in the pending list after reading but before XACK?
Because reading a message moves it to the pending list until the consumer confirms processing by sending XACK (see execution_table step 1 and 2).
What happens if the consumer never sends XACK?
The message remains in the pending list and can be claimed by other consumers later (not shown here but implied by step 3 importance).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the Redis response when XACK is sent?
A"1"
B"Message delivered"
C"Next message available"
D"N/A"
💡 Hint
Check execution_table row 3 under Redis Response.
At which step does the message get removed from the pending list?
AStep 1
BStep 2
CStep 3
DStep 4
💡 Hint
Look at the Effect column in execution_table rows.
If the consumer processes the message but never sends XACK, what happens to the message_status variable after Step 3?
A"acknowledged"
B"processing"
C"pending"
D"unread"
💡 Hint
Refer to variable_tracker for message_status changes.
Concept Snapshot
XACK command acknowledges a message in a Redis stream consumer group.
Syntax: XACK <stream> <group> <message-id>
Marks message as processed, removing it from the pending list.
Without XACK, message stays pending and can be re-delivered.
Used after consumer processes the message successfully.
Full Transcript
In Redis streams, when a consumer reads a message, it moves to a pending list. The consumer must send the XACK command with the stream name, group name, and message ID to acknowledge processing. This removes the message from the pending list, so Redis knows it was handled. If the consumer does not send XACK, the message remains pending and can be delivered again. The execution flow shows reading the message, processing it, sending XACK, and then the message is removed from pending. Variables track the message status and pending list contents step-by-step.