feat:REQ-1419 移除分布式任务相关依赖
This commit is contained in:
parent
a493965d0f
commit
e045ecd208
@ -26,10 +26,6 @@
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.axzo.framework</groupId>
|
||||
<artifactId>axzo-web-spring-boot-starter</artifactId>
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
package cn.axzo.im.job;
|
||||
|
||||
import cn.azxo.framework.common.logger.JobLoggerTemplate;
|
||||
import cn.azxo.framework.common.service.JobParamResolver;
|
||||
import com.xxl.job.core.biz.model.ReturnT;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 基础定时任务
|
||||
*
|
||||
* @author zhaoyong
|
||||
* @see BaseJobHandler
|
||||
* @since 2021-06-23 18:32
|
||||
*/
|
||||
public abstract class BaseJobHandler {
|
||||
|
||||
@Resource(name = "jobLoggerTemplate")
|
||||
protected JobLoggerTemplate jobLoggerTemplate;
|
||||
|
||||
@Resource(name = "jobParamResolver")
|
||||
protected JobParamResolver jobParamResolver;
|
||||
|
||||
/**
|
||||
* 定时任务执行逻辑
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public abstract ReturnT<String> execute(String param) throws Exception;
|
||||
|
||||
}
|
||||
@ -1,49 +0,0 @@
|
||||
package cn.axzo.im.job;
|
||||
|
||||
import cn.axzo.basics.profiles.api.UserProfileServiceApi;
|
||||
import cn.azxo.framework.common.utils.LogUtil;
|
||||
import com.xxl.job.core.biz.model.ReturnT;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 定时同步新建用户IM账户
|
||||
* 1.捞取当前未注册IM账户的用户
|
||||
* 2.创建IM账户,多个App类型终端都创建
|
||||
* 3.更新IM账户到用户系统
|
||||
* @author zuoqinbo
|
||||
* @see SyncImAccountJobHandler
|
||||
* @since 2023-10-20 11:58
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SyncImAccountJobHandler extends BaseJobHandler {
|
||||
/**
|
||||
* MDC 日志 KEY
|
||||
*/
|
||||
public static final String CTX_LOG_ID_MDC = "ctxLogId";
|
||||
|
||||
@Resource
|
||||
private UserProfileServiceApi userProfileServiceApi;
|
||||
|
||||
|
||||
@Override
|
||||
@XxlJob("syncImAccountJobHandler")
|
||||
public ReturnT<String> execute(String param) {
|
||||
return jobLoggerTemplate.execute(CTX_LOG_ID_MDC, () -> {
|
||||
log.info("SyncImAccountJobHandler.execute task Start ......");
|
||||
try {
|
||||
System.out.println("sync im account to user info");
|
||||
} catch (Exception e) {
|
||||
LogUtil.error("SyncImAccountJobHandler.execute is error", e);
|
||||
return ReturnT.FAIL;
|
||||
}
|
||||
log.info("SyncImAccountJobHandler.execute task End ......");
|
||||
return ReturnT.SUCCESS;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,70 +0,0 @@
|
||||
package cn.axzo.im.job;
|
||||
|
||||
import cn.azxo.framework.common.logger.JobLoggerTemplate;
|
||||
import cn.azxo.framework.common.service.JobParamResolver;
|
||||
import cn.azxo.framework.common.spring.condition.NonLocalEnvironment;
|
||||
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Xxl Job Config
|
||||
*
|
||||
* @author zhaoyong
|
||||
* @see XxlJobConfig
|
||||
* @since 2021-06-23 18:28
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration
|
||||
public class XxlJobConfig {
|
||||
|
||||
@Value("${xxl.job.admin.addresses}")
|
||||
private String adminAddresses;
|
||||
|
||||
@Value("${xxl.job.executor.appName}")
|
||||
private String appName;
|
||||
|
||||
@Value("${xxl.job.executor.ip:}")
|
||||
private String ip;
|
||||
|
||||
@Value("${xxl.job.executor.port}")
|
||||
private int port;
|
||||
|
||||
@Value("${xxl.job.accessToken:}")
|
||||
private String accessToken;
|
||||
|
||||
@Value("${xxl.job.executor.logPath:}")
|
||||
private String logPath;
|
||||
|
||||
@Value("${xxl.job.executor.logRetentionDays}")
|
||||
private int logRetentionDays;
|
||||
|
||||
@Bean
|
||||
@NonLocalEnvironment
|
||||
public XxlJobSpringExecutor xxlJobExecutor() {
|
||||
log.info("----axzo im-center service xxl-job cn.axzo.im.config init---");
|
||||
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
|
||||
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
|
||||
xxlJobSpringExecutor.setAppname(appName);
|
||||
xxlJobSpringExecutor.setIp(ip);
|
||||
xxlJobSpringExecutor.setPort(port);
|
||||
xxlJobSpringExecutor.setAccessToken(accessToken);
|
||||
xxlJobSpringExecutor.setLogPath(logPath);
|
||||
xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
|
||||
return xxlJobSpringExecutor;
|
||||
}
|
||||
|
||||
|
||||
@Bean("jobParamResolver")
|
||||
public JobParamResolver jobParamResolver() {
|
||||
return new JobParamResolver();
|
||||
}
|
||||
|
||||
@Bean("jobLoggerTemplate")
|
||||
public JobLoggerTemplate jobLoggerTemplate() {
|
||||
return new JobLoggerTemplate();
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user