|
@@ -1,14 +1,12 @@
|
|
|
package com.citu.module.menduner.system.mq.consumer;
|
|
|
|
|
|
-import com.citu.framework.tenant.core.aop.TenantIgnore;
|
|
|
import com.citu.module.menduner.system.api.python.GraphApi;
|
|
|
import com.citu.module.menduner.system.api.python.GraphSendDTO;
|
|
|
-import com.citu.module.menduner.system.controller.base.job.JobAdvertisedRespVO;
|
|
|
-import com.citu.module.menduner.system.convert.JobAdvertisedConvert;
|
|
|
-import com.citu.module.menduner.system.enums.sync.SyncConstants;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
|
|
|
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
|
|
import org.apache.rocketmq.spring.core.RocketMQListener;
|
|
|
+import org.apache.rocketmq.spring.core.RocketMQPushConsumerLifecycleListener;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -22,16 +20,22 @@ import javax.annotation.Resource;
|
|
|
topic = GraphSendDTO.SYNC_GRAPH_TOPIC,
|
|
|
consumerGroup = GraphSendDTO.SYNC_GRAPH_TOPIC + "_CONSUMER"
|
|
|
)
|
|
|
-public class GraphConsumer implements RocketMQListener<GraphSendDTO> {
|
|
|
+public class GraphConsumer implements RocketMQListener<GraphSendDTO>, RocketMQPushConsumerLifecycleListener {
|
|
|
|
|
|
@Resource
|
|
|
private GraphApi graphApi;
|
|
|
|
|
|
@Override
|
|
|
- public void onMessage(GraphSendDTO message) {
|
|
|
+ public void onMessage(GraphSendDTO message) {
|
|
|
log.info("GraphConsumer-接收到队列消息[{}]", message);
|
|
|
graphApi.send(message).getCheckedData();
|
|
|
log.info("GraphConsumer-消息处理完备[{}]", message);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void prepareStart(DefaultMQPushConsumer consumer) {
|
|
|
+ // 不重试
|
|
|
+ consumer.setMaxReconsumeTimes(0);
|
|
|
+ }
|
|
|
+
|
|
|
}
|