新增测试用例
This commit is contained in:
parent
1a3224e0ad
commit
db431e5565
@ -0,0 +1,28 @@
|
|||||||
|
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.job.core.dto.JobContext;
|
||||||
|
import com.aizuda.easy.retry.client.model.ExecuteResult;
|
||||||
|
import com.aizuda.easy.retry.common.core.util.JsonUtil;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author www.byteblogs.com
|
||||||
|
* @date 2023-09-28 22:54:07
|
||||||
|
* @since 2.4.0
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@JobExecutor(name = "testJobExecutor")
|
||||||
|
public class TestAnnoJobExecutor {
|
||||||
|
|
||||||
|
public ExecuteResult jobExecute(JobArgs jobArgs) {
|
||||||
|
System.out.println(JsonUtil.toJsonString(jobArgs));
|
||||||
|
// try {
|
||||||
|
// Thread.sleep(30 * 1000);
|
||||||
|
// } catch (InterruptedException e) {
|
||||||
|
// throw new RuntimeException(e);
|
||||||
|
// }
|
||||||
|
return ExecuteResult.success("测试成功");
|
||||||
|
}
|
||||||
|
}
|
@ -1,9 +1,8 @@
|
|||||||
package com.example.easy.retry.job;
|
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.job.core.dto.JobContext;
|
import com.aizuda.easy.retry.client.job.core.executor.AbstractJobExecutor;
|
||||||
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 org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -12,16 +11,10 @@ import org.springframework.stereotype.Component;
|
|||||||
* @since 2.4.0
|
* @since 2.4.0
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@JobExecutor(name = "testJobExecutor")
|
public class TestJobExecutor extends AbstractJobExecutor {
|
||||||
public class TestJobExecutor {
|
|
||||||
|
|
||||||
public ExecuteResult jobExecute(JobContext context) {
|
@Override
|
||||||
System.out.println(JsonUtil.toJsonString(context));
|
protected ExecuteResult doJobExecute(JobArgs jobArgs) {
|
||||||
try {
|
return null;
|
||||||
Thread.sleep(30 * 1000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
return ExecuteResult.success();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user