XCLAIM

Apply for Redis Developer Course Redis Regular Inspection / Technical Support Redis Enterprise Server

Claim pending entries

If the application dies after XREADGROUP, those entries stay pending. XCLAIM lets another consumer take entries whose pending time (from XPENDING) is high enough.
Usage: XCLAIM key group consumer min-idle-time ID.

Example

Command>XCLAIM sensor-1234 cg-A C3 5000 1539035297138-0
Result> 1) 1) 1539035297138-0
    2) 1) "temperature"
        2) "101"
  • The example claims entries whose min-idle-time (pending time) is at least 5 seconds.
  • XCLAIM resets idle time to 0, so a second client cannot claim the same entries immediately.
  • After processing you still need XACK.

Other options

These options are used internally for AOF rewriting and for replicas.

  • IDLE <ms>: set idle time. Defaults to 0 if omitted.
  • TIME <ms-unix-time>: same meaning as idle, but as Unix time. Used when writing AOF.
  • RETRYCOUNT <count>: set the delivered count.
  • FORCE: force the entry into the pending list (PEL).
  • JUSTID: return IDs only.

Syntax

XCLAIM key group consumer min-idle-time ID [ID ...]
[IDLE ms] [TIME ms-unix-time]
[RETRYCOUNT count] [FORCE] [JUSTID]

  • Available since version 5.0.0.
  • Time complexity is O(log(N)), where N is the number of pending entries.

<< XPENDING XCLAIM XAUTOCLAIM >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.