新增工作流测试类
This commit is contained in:
parent
e525666995
commit
ac7340ca01
6
pom.xml
6
pom.xml
@ -38,17 +38,17 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.aizuda</groupId>
|
<groupId>com.aizuda</groupId>
|
||||||
<artifactId>easy-retry-client-starter</artifactId>
|
<artifactId>easy-retry-client-starter</artifactId>
|
||||||
<version>2.5.0</version>
|
<version>2.6.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.aizuda</groupId>
|
<groupId>com.aizuda</groupId>
|
||||||
<artifactId>easy-retry-client-core</artifactId>
|
<artifactId>easy-retry-client-core</artifactId>
|
||||||
<version>2.5.0</version>
|
<version>2.6.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.aizuda</groupId>
|
<groupId>com.aizuda</groupId>
|
||||||
<artifactId>easy-retry-client-job-core</artifactId>
|
<artifactId>easy-retry-client-job-core</artifactId>
|
||||||
<version>2.5.0</version>
|
<version>2.6.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.freemarker</groupId>
|
<groupId>org.freemarker</groupId>
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.example.easy.retry.controller;
|
||||||
|
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xiaowoniu
|
||||||
|
* @date 2024-01-03 21:09:14
|
||||||
|
* @since 2.6.0
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/workflow/callback")
|
||||||
|
@Slf4j
|
||||||
|
public class WorkflowCallbackController {
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public void callback(@RequestBody Object object, @RequestHeader HttpHeaders headers) {
|
||||||
|
log.info("callback: {}, secret:{} secret:{}", object, "secret", headers.getFirst("secret"));
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,7 @@ import com.aizuda.easy.retry.client.job.core.annotation.JobExecutor;
|
|||||||
import com.aizuda.easy.retry.client.job.core.dto.JobArgs;
|
import com.aizuda.easy.retry.client.job.core.dto.JobArgs;
|
||||||
import com.aizuda.easy.retry.client.model.ExecuteResult;
|
import com.aizuda.easy.retry.client.model.ExecuteResult;
|
||||||
import com.aizuda.easy.retry.common.core.util.JsonUtil;
|
import com.aizuda.easy.retry.common.core.util.JsonUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -12,12 +13,14 @@ import org.springframework.stereotype.Component;
|
|||||||
* @since 2.4.0
|
* @since 2.4.0
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
|
@Slf4j
|
||||||
@JobExecutor(name = "testAnnoJobExecutorSleep5s")
|
@JobExecutor(name = "testAnnoJobExecutorSleep5s")
|
||||||
public class TestAnnoJobExecutorSleep5s {
|
public class TestAnnoJobExecutorSleep5s {
|
||||||
|
|
||||||
public ExecuteResult jobExecute(JobArgs jobArgs) {
|
public ExecuteResult jobExecute(JobArgs jobArgs) {
|
||||||
System.out.println(JsonUtil.toJsonString(jobArgs));
|
log.info("testAnnoJobExecutorSleep5s. jobArgs:{}", JsonUtil.toJsonString(jobArgs));
|
||||||
try {
|
|
||||||
|
try {
|
||||||
Thread.sleep(5 * 1000);
|
Thread.sleep(5 * 1000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.example.easy.retry.job;
|
||||||
|
|
||||||
|
import com.aizuda.easy.retry.client.job.core.annotation.JobExecutor;
|
||||||
|
import com.aizuda.easy.retry.client.job.core.dto.JobArgs;
|
||||||
|
import com.aizuda.easy.retry.client.model.ExecuteResult;
|
||||||
|
import com.example.easy.retry.po.FailOrderPo;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author www.byteblogs.com
|
||||||
|
* @date 2023-09-28 22:54:07
|
||||||
|
* @since 2.6.0
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@JobExecutor(name = "testWorkflowAnnoJobExecutor")
|
||||||
|
public class TestWorkflowAnnoJobExecutor {
|
||||||
|
|
||||||
|
public ExecuteResult jobExecute(JobArgs jobArgs) {
|
||||||
|
FailOrderPo failOrderPo = new FailOrderPo();
|
||||||
|
failOrderPo.setOrderId("xiaowoniu");
|
||||||
|
return ExecuteResult.success(failOrderPo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -10,14 +10,11 @@ import com.baomidou.mybatisplus.generator.config.StrategyConfig;
|
|||||||
|
|
||||||
public class CodeGen {
|
public class CodeGen {
|
||||||
|
|
||||||
@Value("${spring.datasource.url}")
|
private static String dataSourceUrl = "jdbc:mysql://localhost:3306/easy_retry_260?useSSL=false&characterEncoding=utf8&useUnicode=true";
|
||||||
private static String dataSourceUrl;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.username}")
|
private static String userName = "root";
|
||||||
private static String userName;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.password}")
|
private static String password= "root";
|
||||||
private static String password;
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
DataSourceConfig dataSourceConfig = new DataSourceConfig.Builder(dataSourceUrl, userName, password).build();
|
DataSourceConfig dataSourceConfig = new DataSourceConfig.Builder(dataSourceUrl, userName, password).build();
|
||||||
@ -25,17 +22,17 @@ public class CodeGen {
|
|||||||
// 全局配置
|
// 全局配置
|
||||||
GlobalConfig globalConfig = new GlobalConfig.Builder()
|
GlobalConfig globalConfig = new GlobalConfig.Builder()
|
||||||
.outputDir("src/main/java")
|
.outputDir("src/main/java")
|
||||||
.author("maluxinyu")
|
.author("xiaowoniu")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// 策略配置
|
// 策略配置
|
||||||
StrategyConfig strategyConfig = new StrategyConfig.Builder()
|
StrategyConfig strategyConfig = new StrategyConfig.Builder()
|
||||||
.addInclude("fail_order") // 需要生成的表名
|
.addInclude("workflow") // 需要生成的表名
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// 包配置
|
// 包配置
|
||||||
PackageConfig packageConfig = new PackageConfig.Builder()
|
PackageConfig packageConfig = new PackageConfig.Builder()
|
||||||
.parent("com.maluxinyu.easyretry")
|
.parent("com.aizuda.easy.retry.template.datasource.persistence.po")
|
||||||
.moduleName("easy-retry-springboot")
|
.moduleName("easy-retry-springboot")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ spring:
|
|||||||
active: dev
|
active: dev
|
||||||
datasource:
|
datasource:
|
||||||
name: easy_retry
|
name: easy_retry
|
||||||
url: jdbc:mysql://localhost:3306/demo?useSSL=false&characterEncoding=utf8&useUnicode=true
|
url: jdbc:mysql://localhost:3306/easy_retry_260?useSSL=false&characterEncoding=utf8&useUnicode=true
|
||||||
username: root
|
username: root
|
||||||
password: root
|
password: root
|
||||||
type: com.zaxxer.hikari.HikariDataSource
|
type: com.zaxxer.hikari.HikariDataSource
|
||||||
|
Loading…
Reference in New Issue
Block a user