go-redis v8 XAutoClaim is not compatible with Redis server v7+
Feb 09, 2024 pm 04:54 PMphp editor Zimo is here to introduce to you an important issue, that is, the XAutoClaim function of go-redis v8 is incompatible with Redis server v7. It is understood that go-redis is a popular Golang Redis client library, and XAutoClaim is a new feature in its latest version, which can be used to automatically allocate tasks in the Redis queue. However, when using this function, it was found that it was incompatible with Redis server v7, causing it to not work properly. This problem may cause some trouble to developers using go-redis, so we need to find a solution to solve this compatibility issue.
Question content
Question
I'm using go-redis v8 with a redis v7 server instance. As far as I know, the XAutoClaim
command is not compatible.
client.XAutoClaim
Returned error: got 3, wanted 2
.
The official go-redis/v8 documentation on XAutoClaim makes no mention of incompatibility with redis version 7.
Steps to reproduce
ctx := context.Background() streamName := "test-stream" groupName := "test-group" rdb := redis.NewClient(&redis.Options{ Addr: "localhost:6379", Password: "", // no password set DB: 0, // use default DB }) defer rdb.FlushDB(ctx).Err() // Add message to stream rdb.XAdd(ctx, &redis.XAddArgs{ Stream: streamName, Values: map[string]interface{}{"key": "value"}, }) // Create consumer group rdb.XGroupCreateMkStream(ctx, streamName, groupName, "0") autoclaimError := rdb.XAutoClaim(ctx, &redis.XAutoClaimArgs{ Stream: streamName, Group: groupName, Consumer: "test-consumer", MinIdle: 0, Start: "-", Count: 1, }).Err() print(autoclaimError.Error())
Solution
go-redis v8 XAutoClaim is not compatible with Redis version 7. Although this issue is not officially documented, there is an issue about it here: https:///github.com/redis/go-redis/issues/2106.
The above is the detailed content of go-redis v8 XAutoClaim is not compatible with Redis server v7+. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Go language pack import: What is the difference between underscore and without underscore?

How to implement short-term information transfer between pages in the Beego framework?

How do I write mock objects and stubs for testing in Go?

How can I use tracing tools to understand the execution flow of my Go applications?

How can I define custom type constraints for generics in Go?

How to write files in Go language conveniently?

How to convert MySQL query result List into a custom structure slice in Go language?

How do I write benchmarks that accurately reflect real-world performance in Go?
