瀏覽代碼

update mq topic

deason 1 月之前
父節點
當前提交
8a9166cc60

+ 8 - 8
examcloud-core-reports-api-provider/src/main/java/cn/com/qmth/examcloud/core/reports/api/listener/RocketMqConsumerListener.java

@@ -47,9 +47,9 @@ public class RocketMqConsumerListener {
     }
 
     private static void onlineExamStudent() {
-        properties.put(PropertyKeyConst.GROUP_ID, Tag.ONLINE_EXAM_STUDENT.getGroup() + "_" + ReportsUtil.getProfile());
+        properties.put(PropertyKeyConst.GROUP_ID, ReportsUtil.curConsumerGroup(Tag.ONLINE_EXAM_STUDENT));
         Consumer consumer = ONSFactory.createConsumer(properties);
-        consumer.subscribe(ReportsUtil.getReportTopic(), Tag.ONLINE_EXAM_STUDENT.getCode(), new MessageListener() {
+        consumer.subscribe(ReportsUtil.curTopic(Tag.ONLINE_EXAM_STUDENT), Tag.ONLINE_EXAM_STUDENT.name(), new MessageListener() {
 
             @Override
             public Action consume(Message message, ConsumeContext context) {
@@ -68,9 +68,9 @@ public class RocketMqConsumerListener {
     }
 
     private static void onlineStudent() {
-        properties.put(PropertyKeyConst.GROUP_ID, Tag.ONLINE_STUDENT.getGroup() + "_" + ReportsUtil.getProfile());
+        properties.put(PropertyKeyConst.GROUP_ID, ReportsUtil.curConsumerGroup(Tag.ONLINE_STUDENT));
         Consumer consumer = ONSFactory.createConsumer(properties);
-        consumer.subscribe(ReportsUtil.getReportTopic(), Tag.ONLINE_STUDENT.getCode(), new MessageListener() {
+        consumer.subscribe(ReportsUtil.curTopic(Tag.ONLINE_STUDENT), Tag.ONLINE_STUDENT.name(), new MessageListener() {
 
             @Override
             public Action consume(Message message, ConsumeContext context) {
@@ -89,9 +89,9 @@ public class RocketMqConsumerListener {
     }
 
     private static void onlineUser() {
-        properties.put(PropertyKeyConst.GROUP_ID, Tag.ONLINE_USER.getGroup() + "_" + ReportsUtil.getProfile());
+        properties.put(PropertyKeyConst.GROUP_ID, ReportsUtil.curConsumerGroup(Tag.ONLINE_USER));
         Consumer consumer = ONSFactory.createConsumer(properties);
-        consumer.subscribe(ReportsUtil.getReportTopic(), Tag.ONLINE_USER.getCode(), new MessageListener() {
+        consumer.subscribe(ReportsUtil.curTopic(Tag.ONLINE_USER), Tag.ONLINE_USER.name(), new MessageListener() {
 
             @Override
             public Action consume(Message message, ConsumeContext context) {
@@ -110,9 +110,9 @@ public class RocketMqConsumerListener {
     }
 
     private static void operateInfo() {
-        properties.put(PropertyKeyConst.GROUP_ID, Tag.OPERATE_INFO.getGroup() + "_" + ReportsUtil.getProfile());
+        properties.put(PropertyKeyConst.GROUP_ID, ReportsUtil.curConsumerGroup(Tag.OPERATE_INFO));
         Consumer consumer = ONSFactory.createConsumer(properties);
-        consumer.subscribe(ReportsUtil.getReportTopic(), Tag.OPERATE_INFO.getCode(), new MessageListener() {
+        consumer.subscribe(ReportsUtil.curTopic(Tag.OPERATE_INFO), Tag.OPERATE_INFO.name(), new MessageListener() {
 
             @Override
             public Action consume(Message message, ConsumeContext context) {