Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
utils
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
golang kittool
utils
Commits
0a9cacaf
Commit
0a9cacaf
authored
May 05, 2022
by
feidy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add rocketmq tag test
parent
a2afd2c5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
1 deletions
+36
-1
rocketmq_test.go
queue/rocketmq_test.go
+36
-1
No files found.
queue/rocketmq_test.go
View file @
0a9cacaf
...
...
@@ -2,7 +2,7 @@
* @Author: zhoufei
* @Date: 2022-04-24 14:19:58
* @LastEditors: zhoufei
* @LastEditTime: 2022-0
4-25 09:24:52
* @LastEditTime: 2022-0
5-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"
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment