I am using github.com/gomodule/redigo/redis library.
LPOP is working:
Queue := "queue1"
conn.Do("LPOP", Queue)
How can I use Blpop with multiple queues(Dynamic array, read from config file)
var QueueArray []string
QueueArray[0] = "q1"
QueueArray[1] = "q2"
conn.Do("BLPOP", QueueArray,0)
This does not fetch any record.
Each list is a separate argument to the BLPOP command.
Use one function argument for each Redis argument with the Redigo client.
resp, err = conn.Do(“BLPOP”, “q1”, “q2”, 0)
Use redis.Args to create an argument list from an a slice:
resp, err := c.Do("BLPOP", redis.Args{}.AddFlat(QueueArray).Add(0)...)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.