添加XXLjob组件和定时任务触发接口
This commit is contained in:
@@ -120,6 +120,12 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job-core</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.volvo.ai.analytic.center.job;
|
||||
|
||||
import com.volvo.ai.analytic.center.service.MqMessageRecordService;
|
||||
import com.volvo.common.core.util.ResultMsg;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class MessageProcessJob {
|
||||
|
||||
@Autowired
|
||||
private MqMessageRecordService mqMessageRecordService;
|
||||
|
||||
/**
|
||||
* 邀约消息推送
|
||||
*/
|
||||
@XxlJob("processMessageByTask")
|
||||
public ResultMsg processMessageByTask() {
|
||||
try {
|
||||
log.info("开始执行定时任务补偿处理消息");
|
||||
mqMessageRecordService.processMessageByTask();
|
||||
} catch (Exception e) {
|
||||
log.error("定时任务补偿处理消息异常",e.getMessage());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return ResultMsg.ok();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user