XACK

Syntax
XACK key group id [id ...]
Available since:
5.0.0
Time complexity:
O(1) for each message ID processed.
ACL categories:
@write, @stream, @fast,

XACK 命令从流消费者组的待处理条目列表 (PEL) 中移除一条或多条消息。当消息被传递给某个消费者时,通常作为调用 XREADGROUP 的副作用,或者当消费者通过调用 XCLAIM 获取消息的所有权时,消息处于待处理状态,并因此存储在 PEL 中。待处理的消息已被传递给某个消费者,但服务器尚未确定它是否至少被处理过一次。因此,新的 XREADGROUP 调用以获取消费者的消息历史记录(例如使用 ID 为 0),将返回此类消息。同样,待处理的消息将由检查 PEL 的 XPENDING 命令列出。

一旦消费者成功处理了一条消息,它应该调用XACK,这样这条消息就不会被再次处理,并且作为副作用,关于这条消息的PEL条目也会被清除,从而释放Redis服务器的内存。

示例

redis> XACK mystream mygroup 1526569495631-0
(integer) 1

RESP2/RESP3 回复

Integer reply: The command returns the number of messages successfully acknowledged. Certain message IDs may no longer be part of the PEL (for example because they have already been acknowledged), and XACK will not count them as successfully acknowledged.
RATE THIS PAGE
Back to top ↑