Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
R
rocket-mq-demo
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
songchuancai
rocket-mq-demo
Commits
d853f32d
提交
d853f32d
authored
1月 20, 2022
作者:
scc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ll
上级
49caa2b1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
8 行增加
和
2 行删除
+8
-2
MqMessageController.java
.../example/rocketmqdemo/controller/MqMessageController.java
+8
-2
没有找到文件。
src/main/java/com/example/rocketmqdemo/controller/MqMessageController.java
浏览文件 @
d853f32d
...
@@ -43,7 +43,12 @@ public class MqMessageController {
...
@@ -43,7 +43,12 @@ public class MqMessageController {
public
List
<
SendResult
>
sendSyncMessage
(
@RequestParam
(
"id"
)
int
id
,
@RequestParam
(
"count"
)
int
count
)
throws
UnsupportedEncodingException
,
MQBrokerException
,
RemotingException
,
InterruptedException
,
MQClientException
{
public
List
<
SendResult
>
sendSyncMessage
(
@RequestParam
(
"id"
)
int
id
,
@RequestParam
(
"count"
)
int
count
)
throws
UnsupportedEncodingException
,
MQBrokerException
,
RemotingException
,
InterruptedException
,
MQClientException
{
List
<
SendResult
>
results
=
new
ArrayList
<>();
List
<
SendResult
>
results
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
SendResult
result
=
rocketMQTemplate
.
syncSend
(
xcRocketMq2
.
getTopicString
(),
"Hello RocketMQ 同步发送消息"
+
i
);
org
.
apache
.
rocketmq
.
common
.
message
.
Message
message
=
new
org
.
apache
.
rocketmq
.
common
.
message
.
Message
();
message
.
setBody
(
"Hello RocketMQ 同步发送消息"
.
getBytes
());
message
.
setKeys
(
"scc-keys"
);
message
.
setTags
(
"scc-tags"
+
i
);
message
.
setTopic
(
"scc-test"
);
SendResult
result
=
rocketMQTemplate
.
syncSend
(
"scc-test:tags-scc"
,
message
);
results
.
add
(
result
);
results
.
add
(
result
);
}
}
return
results
;
return
results
;
...
@@ -86,7 +91,8 @@ public class MqMessageController {
...
@@ -86,7 +91,8 @@ public class MqMessageController {
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
// 创建消息,并指定Topic,Tag和消息体
// 创建消息,并指定Topic,Tag和消息体
// 发送单向消息,没有任何返回结果
// 发送单向消息,没有任何返回结果
rocketMQTemplate
.
sendOneWay
(
xcRocketMq2
.
getTopicString
(),
"发送单向消息"
+
i
);
rocketMQTemplate
.
sendOneWayOrderly
(
"scc-test"
,
"发送单项消息+keys"
,
"single_key"
);
//rocketMQTemplate.sendOneWay("scc-test", "发送单向消息"+i);
}
}
return
"单向发送消息成功"
;
return
"单向发送消息成功"
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论