Stream
XCLAIM
Changes the ownership of pending messages from one consumer to another in a stream consumer group.
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.
idsbodystrrequired
The ID(s) of the message(s) to claim. Can be multiple IDs as separate arguments.
justidbodybool
Return only the message IDs instead of the full message data.
Response
Union[List[List[Any]], List[str]]
Returns a list of claimed messages. If justid option is used, returns only message IDs.
Example
# Claim messages that have been idle for more than 60 secondsresult = redis.xclaim( "mystream", "mygroup", "consumer1", 60000, # 60 seconds "1638360173533-0", "1638360173533-1")With justid option
result = redis.xclaim( "mystream", "mygroup", "consumer1", 60000, "1638360173533-0", justid=True)[ ["1638360173533-0", ["field1", "value1", "field2", "value2"]], ["1638360173533-1", ["field1", "value3", "field2", "value4"]]]