Commit 0a9cacaf by feidy

add rocketmq tag test

parent a2afd2c5
......@@ -2,7 +2,7 @@
* @Author: zhoufei
* @Date: 2022-04-24 14:19:58
* @LastEditors: zhoufei
* @LastEditTime: 2022-04-25 09:24:52
* @LastEditTime: 2022-05-05 14:32:59
* @FilePath: /utils/queue/rocketmq_test.go
* @Description: rocketmq 测试
*
......@@ -51,6 +51,24 @@ func TestRocketMqSendMsg(t *testing.T) {
}
}
func TestRocketMqProducerWithTag(t *testing.T) {
producer, err := getProducer()
if err != nil {
t.Fatal(err)
}
_, err = producer.SendMsg("test", []byte("tag2 test"), WithMsgTag("tag2"))
if err != nil {
t.Fatal(err)
}
time.Sleep(3 * time.Second)
err = producer.ShutDown()
if err != nil {
t.Fatal(err)
}
}
func TestRocketMqConsumer(t *testing.T) {
client, err := NewRocketMqConsumer([]string{"http://39.101.151.217:9876"}, "test")
if err != nil {
......@@ -79,6 +97,23 @@ func TestRocketMqConsumer(t *testing.T) {
client.ShutDown()
}
func TestRocketMqConsumerWithTag(t *testing.T) {
consumer, err := NewRocketMqConsumer([]string{"http://39.101.151.217:9876"}, "test")
if err != nil {
t.Fatal(err)
}
err = consumer.RegisterConsumer("test", func(qMsg *QueueMsg) {
fmt.Printf("info:%v\n", qMsg.Body)
}, WithMsgTag("tag2"))
if err != nil {
t.Fatal(err)
}
time.Sleep(3 * time.Second)
consumer.ShutDown()
}
func TestAliRocket(t *testing.T) {
p, err := NewRocketMqProducer([]string{"http://onsaddr.mq-internet-access.mq-internet.aliyuncs.com:80"}, "test", 2,
WithRocketAcl("xxxxx", "xxxxxxxx"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment