Commit 513e03f8 by qiuweili123

调整示例rocketmq

parent dc8d1ef5
...@@ -28,15 +28,17 @@ public class RoketMqSampleApplication implements ApplicationRunner { ...@@ -28,15 +28,17 @@ public class RoketMqSampleApplication implements ApplicationRunner {
user.setId(1L); user.setId(1L);
user.setName("zhangsan"); user.setName("zhangsan");
String createTagName = ":create"; String createTagName = ":create";
String createTagName2 = ":create2";
//1.没有指定tag,单项发送消息 //1.没有指定tag,单项发送消息
template.sendOneWay(topicName, user); template.sendOneWay(topicName, user);
/* 注意:org.springframework.messaging.Message为默认对象,此对象是spring对所有消息体的抽象, /* 注意:org.springframework.messaging.Message为默认对象,此对象是spring对所有消息体的抽象,
* 而MessageExt为RoketMq自身对象,包含更细节信息,如msgId * 而MessageExt为RoketMq自身对象,包含更细节信息,如msgId
* */ * */
//2.指定tag,并同步发送消息 //2.指定tag,并同步发送消息
//指定tag为create发送到topic //指定tag为create发送到topic。topic和name之间用“:”分割
template.syncSend(topicName + createTagName, user, 10000); template.syncSend(topicName + createTagName2, user, 10000);
} }
} }
\ No newline at end of file
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