git-svn-id: svn://47.119.165.148/zhub@63 e63fbceb-bcc3-4977-ac22-735b83d8d0f4
This commit is contained in:
lxy
2021-01-09 10:53:35 +00:00
parent 2dcfc5e9bf
commit f1b7a862f9
15 changed files with 377 additions and 50 deletions

35
cli_test.go Normal file
View File

@@ -0,0 +1,35 @@
package main
import (
"log"
"strconv"
"testing"
"time"
"zhub/cli"
)
func TestCli(t *testing.T) {
//client, err := cli.Create("39.108.56.246:1216", "")
client, err := cli.Create("127.0.0.1:1216", "")
if err != nil {
log.Fatal(err)
}
// 订阅主题 消息
client.Subscribe("a", func(v string) {
log.Println("收到主题 a 消息 " + v)
})
//
client.Timer("t", "* * * * * *")
go func() {
for i := 0; i < 50000; i++ {
client.Publish("a", strconv.Itoa(i))
time.Sleep(time.Second)
}
}()
time.Sleep(time.Hour * 3)
}