Stream
XAUTOCLAIM
Changes the ownership of pending messages from one consumer to another in a stream consumer group automatically.
Arguments
keybodystrrequired
The key of the stream.
groupbodystrrequired
The consumer group name.
consumerbodystrrequired
The consumer name that will claim the messages.
min_idle_timebodyintrequired
The minimum idle time in milliseconds for messages to be claimed.
startbodystrrequired
The stream entry ID to start claiming from.
countbodyint
The maximum number of messages to claim.
justidbodybool
Return only the message IDs instead of the full message data.
Response
Tuple[str, List[Any], List[str]]
Returns a list containing:
- Next start ID for pagination
- List of claimed messages. If
justidoption is used, returns only message IDs. - List of deleted message IDs
Example
# Auto-claim messages that have been idle for more than 60 secondsresult = redis.xautoclaim( "mystream", "mygroup", "consumer1", 60000, # 60 seconds start="0-0")With count and justid
result = redis.xautoclaim( "mystream", "mygroup", "consumer1", 60000, start="0-0", count=5, justid=True)[ "1638360173533-1", # next start ID [["1638360173533-0", ["field1", "value1", "field2", "value2"]]], # claimed messages [] # deleted message IDs]