新增多个执行器
This commit is contained in:
parent
db431e5565
commit
a896bd9ef7
@ -17,12 +17,6 @@ import org.springframework.stereotype.Component;
|
||||
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("测试成功");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
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.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 = "testAnnoJobExecutorSleep10s")
|
||||
public class TestAnnoJobExecutorSleep10s {
|
||||
|
||||
public ExecuteResult jobExecute(JobArgs jobArgs) {
|
||||
System.out.println(JsonUtil.toJsonString(jobArgs));
|
||||
try {
|
||||
Thread.sleep(10 * 1000);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return ExecuteResult.success("测试成功");
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
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.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 = "testAnnoJobExecutorSleep1s")
|
||||
public class TestAnnoJobExecutorSleep1s {
|
||||
|
||||
public ExecuteResult jobExecute(JobArgs jobArgs) {
|
||||
System.out.println(JsonUtil.toJsonString(jobArgs));
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return ExecuteResult.success("测试成功");
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
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.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 = "testAnnoJobExecutorSleep30s")
|
||||
public class TestAnnoJobExecutorSleep30s {
|
||||
|
||||
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("测试成功");
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
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.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 = "testAnnoJobExecutorSleep5s")
|
||||
public class TestAnnoJobExecutorSleep5s {
|
||||
|
||||
public ExecuteResult jobExecute(JobArgs jobArgs) {
|
||||
System.out.println(JsonUtil.toJsonString(jobArgs));
|
||||
try {
|
||||
Thread.sleep(5 * 1000);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return ExecuteResult.success("测试成功");
|
||||
}
|
||||
}
|
@ -11,10 +11,10 @@ import org.springframework.stereotype.Component;
|
||||
* @since 2.4.0
|
||||
*/
|
||||
@Component
|
||||
public class TestJobExecutor extends AbstractJobExecutor {
|
||||
public class TestClassJobExecutor extends AbstractJobExecutor {
|
||||
|
||||
@Override
|
||||
protected ExecuteResult doJobExecute(JobArgs jobArgs) {
|
||||
return null;
|
||||
return ExecuteResult.success("TestJobExecutor测试成功");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user