feat(可回溯): 配置生成视频定时任务

增加xxljobp配置
This commit is contained in:
BrandWang
2023-05-24 17:55:23 +08:00
parent 1d293a063c
commit 70b628b446
3 changed files with 77 additions and 0 deletions
+7
View File
@@ -23,6 +23,13 @@
<alibaba.boot.druid>1.1.22</alibaba.boot.druid> <alibaba.boot.druid>1.1.22</alibaba.boot.druid>
</properties> </properties>
<dependencies> <dependencies>
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
<version>2.3.0</version>
</dependency>
<dependency> <dependency>
<groupId>com.wabestway.recall</groupId> <groupId>com.wabestway.recall</groupId>
<artifactId>afis-recall-api</artifactId> <artifactId>afis-recall-api</artifactId>
@@ -0,0 +1,23 @@
package com.wabestway.recall.jobtask;
import com.wabestway.recall.trace.service.RecallOrderApiService;
import com.xxl.job.core.biz.model.ReturnT;
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 GenVideoJobHandler {
@Autowired
private RecallOrderApiService recallOrderApiService;
@XxlJob("VideoGenJobHandler")
public ReturnT<String> genRecallVideo() {
log.info("[定时器:回溯视频]-开始执行");
recallOrderApiService.traceVideo();
log.info("[定时器:回溯视频]-执行完成");
return ReturnT.SUCCESS;
}
}
@@ -0,0 +1,47 @@
package com.wabestway.recall.jobtask;
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class XXLJobConfig {
private Logger logger = LoggerFactory.getLogger(XXLJobConfig.class);
@Value("${xxl.job.admin.addresses}")
private String adminAddresses;
@Value("${xxl.job.accessToken}")
private String accessToken;
@Value("${xxl.job.executor.appname}")
private String appname;
@Value("${xxl.job.executor.port:-1}")
private int port;
@Value("${xxl.job.executor.logpath}")
private String logPath;
@Value("${xxl.job.executor.logretentiondays}")
private int logRetentionDays;
@Bean
public XxlJobSpringExecutor xxlJobExecutor() {
logger.info(">>>>>>>>>>> xxl-job config init.");
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
xxlJobSpringExecutor.setAppname(appname);
xxlJobSpringExecutor.setPort(port);
xxlJobSpringExecutor.setAccessToken(accessToken);
xxlJobSpringExecutor.setLogPath(logPath);
xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
return xxlJobSpringExecutor;
}
}