1 Star 0 Fork 0

sven / gqueue

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
queue_test.go 596 Bytes
一键复制 编辑 原始数据 按行查看 历史
sven 提交于 2023-07-07 11:06 . 增加前辍
package gqueue
import (
"fmt"
"os"
"testing"
)
func init() {
conn := os.Getenv("TEST_REDIS")
fmt.Println(conn)
InitGlobalQueue(RedisDrive, conn)
}
func TestQueueRedis_Publish(t *testing.T) {
q := GetGlobalQueue()
q.Publish("testqueue", `{"aaa":"bbb"}`)
q.Publish("testqueue2", `{"aaa":"bbb2"}`)
}
func TestQueueRedis_Subscribe(t *testing.T) {
q := GetGlobalQueue()
q.Subscribe("testqueue", func(msg string) bool {
fmt.Println("testqueue", msg)
return true
})
q.Subscribe("testqueue2", func(msg string) bool {
fmt.Println("testqueue2", msg)
return true
})
select {}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zjlsliupei/gqueue.git
git@gitee.com:zjlsliupei/gqueue.git
zjlsliupei
gqueue
gqueue
master

搜索帮助