1.1. 注解@Performance

作用: 使用此注解的作用是为了统计函数的执行时间,以便于查找有性能瓶颈的函数。

实例:

@Performance(apiName="员工同步",dataSource="ARTEMIS")
public String demo(String str) {
    return str;
}
属性 描述
apiName 接口描述
dataSource 数据源系统名称,如Artemis、HEC

1.2. 注解@Retryable

作用: 使用此注解的作用是对进行例外重试的方法进行标记,当方法出现异常,或者在封装对象中标记Success=False时进行重试。 实例:

@Retryable(name = "数据回写")
public IntegrationSuccessResponseDTO doIntegrationSuccess(IntegrationCommonResponseDTO resp) {
    log.debug("doIntegrationSuccess");
    IntegrationSuccessResponseDTO responseDTO = new IntegrationSuccessResponseDTO();
    responseDTO.setSuccess(Boolean.FALSE);
    return responseDTO;
}
属性 描述
name 方法描述

1.3. 配置读取

作用:通过api读取维护在数据库中的配置信息,方便中间件系统在不重启的情况下进行配置变更,同时能做到规范配置项的维护与修改。

com.helioscloud.middleware.service.MidConfigurationService#findConfigurationValueByItem

代码举例如下:

Map<String, String> content = new LinkedHashMap<>();
content.put("authentication_url", midConfigurationService.findConfigurationValueByItem("token.url"));
content.put("grant_type", "client_credentials");
content.put("scope", "write");
content.put("username", midConfigurationService.findConfigurationValueByItem("token.client"));
content.put("password", midConfigurationService.findConfigurationValueByItem("token.secret"));

配置可参考系统配置

默认可用配置项有:

配置项 配置项值 描述
mail.host xxx 邮件服务器
mail.port xxx 邮件端口
mail.username xxx 发件人邮箱
mail.password xxx 发件人密码
mail.to xxx 收件人,可有多个,用逗号隔开
mail.auth xxx 是否开启验证
token.client xxx 企业客户端
token.secret xxx 企业密钥
token.url xxx token获取地址
task.retry.times xxx 任务最大重试次数
task.retry.interval xxx 任务重试间隔

1.4. 任务接口ITaskService

作用: 规范任务调用类,通过实现接口ITaskService,实例化具体任务执行类。 代码举例:

@Service
public class DemoTaskService implements ITaskService {
    @Override
    public void execute(String startDate, String endDate) {
    //TODO
    //在此处实现具体逻辑
    }
}

results matching ""

    No results matching ""