Apply .gitignore rules

This commit is contained in:
皮蛋13361098506
2025-01-06 16:21:36 +08:00
parent 1b77f62820
commit ccd2c530cf
580 changed files with 69806 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
package mqMgr
import (
"fmt"
"testing"
"time"
)
var (
queueHSYObj = NewHSYQueue("q-1", "ex-1", "rkey-1", "guest", "guest", "127.0.0.1", 5672)
)
func TestHSYSendMessage(t *testing.T) {
message := "这是测试内容. Test"
if queueHSYObj == nil {
fmt.Println("初始化失败")
return
}
defer queueHSYObj.ReleaseRes()
err := queueHSYObj.SendMessage(message, "direct")
if err != nil {
t.Errorf("There should be no error, but now there is: %s", err)
return
}
time.Sleep(time.Second)
go func() {
msgs, err := queueHSYObj.ReceiveMessage()
if err != nil {
t.Errorf("There should be no error, but now there is: %s", err)
return
}
for msg := range msgs {
fmt.Println("收到消息", string(msg.Body))
}
}()
time.Sleep(time.Second)
}