diff --git a/.gitignore b/.gitignore index 8f237d5..d8aaea5 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,5 @@ HELP.md .vscode/ .flattened-pom.xml + +/data/ diff --git a/pom.xml b/pom.xml index 522c5c9..369a80a 100644 --- a/pom.xml +++ b/pom.xml @@ -119,7 +119,7 @@ - easy-retry-example + snail-job-example org.springframework.boot diff --git a/src/main/java/com/example/easy/retry/config/SwaggerConfig.java b/src/main/java/com/example/easy/retry/config/SwaggerConfig.java deleted file mode 100644 index 3cd0074..0000000 --- a/src/main/java/com/example/easy/retry/config/SwaggerConfig.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.example.easy.retry.config; - -import com.aizuda.easy.retry.common.core.util.EasyRetryVersion; -import io.swagger.v3.oas.models.ExternalDocumentation; -import io.swagger.v3.oas.models.OpenAPI; -import io.swagger.v3.oas.models.info.Info; -import io.swagger.v3.oas.models.info.License; -import org.springdoc.core.models.GroupedOpenApi; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - - -/** - * @author: www.byteblogs.com - * @date : 2023-07-17 18:19 - * @since 2.1.0 - */ -@Configuration -public class SwaggerConfig { - - @Bean - public OpenAPI springShopOpenAPI() { - return new OpenAPI() - .info(new Info() - .title("Easy Retry Example") - .description("

EasyRetry是致力提高分布式业务系统一致性的分布式重试平台

\n" + - "

官网地址: https://www.easyretry.com/

" + - "

在线体验地址: http://preview.easyretry.com/

" + - "

源码地址: https://gitee.com/byteblogs168/easy-retry-demo

" + - "

特别提醒: 🌻在您使用测试案例之前请认真的阅读官网.

") - .version(EasyRetryVersion.getVersion()) - .license(new License().name("Apache 2.0").url("https://www.easyretry.com/"))) - .externalDocs(new ExternalDocumentation() - .description("视频教程:从0到1快速了解分布式重试组件EasyRetry") - .url("https://www.ixigua.com/pseries/7272009348824433213/")) - ; - } - - @Bean - public GroupedOpenApi adminApi() { - return GroupedOpenApi.builder() - //分组名 - .group("user") - .pathsToMatch("/**") - //扫描路径,将路径下有swagger注解的接口解析到文档中 - .packagesToScan("com.example.easy.retry.controller") - .build(); - } -} - - - - - - diff --git a/src/main/java/com/example/easy/retry/listener/EasyRetryChannelReconnectListener.java b/src/main/java/com/example/easy/retry/listener/EasyRetryChannelReconnectListener.java deleted file mode 100644 index ac1261e..0000000 --- a/src/main/java/com/example/easy/retry/listener/EasyRetryChannelReconnectListener.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.example.easy.retry.listener; - -import com.aizuda.easy.retry.client.common.event.SnailChannelReconnectEvent; -import com.aizuda.easy.retry.common.log.EasyRetryLog; -import org.springframework.context.ApplicationListener; -import org.springframework.stereotype.Component; - -/** - * @author xiaowoniu - * @date 2024-03-14 21:58:18 - * @since 3.1.0 - */ -@Component -public class EasyRetryChannelReconnectListener implements ApplicationListener { - @Override - public void onApplicationEvent(SnailChannelReconnectEvent event) { - EasyRetryLog.LOCAL.info("这个一个重连事件"); - } -} diff --git a/src/main/java/com/example/easy/retry/listener/EasyRetryClosedListener.java b/src/main/java/com/example/easy/retry/listener/EasyRetryClosedListener.java deleted file mode 100644 index 8ba596e..0000000 --- a/src/main/java/com/example/easy/retry/listener/EasyRetryClosedListener.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.example.easy.retry.listener; - -import com.aizuda.easy.retry.client.common.event.SnailClientClosedEvent; -import com.aizuda.easy.retry.common.log.EasyRetryLog; -import org.springframework.context.ApplicationListener; -import org.springframework.stereotype.Component; - -/** - * @author xiaowoniu - * @date 2024-03-14 22:00:58 - * @since 3.1.0 - */ -@Component -public class EasyRetryClosedListener implements ApplicationListener { - @Override - public void onApplicationEvent(SnailClientClosedEvent event) { - EasyRetryLog.LOCAL.info("这是一个EasyRetry关闭完成事件"); - } -} diff --git a/src/main/java/com/example/easy/retry/listener/EasyRetryClosingListener.java b/src/main/java/com/example/easy/retry/listener/EasyRetryClosingListener.java deleted file mode 100644 index f551d2a..0000000 --- a/src/main/java/com/example/easy/retry/listener/EasyRetryClosingListener.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.example.easy.retry.listener; - -import com.aizuda.easy.retry.client.common.event.SnailClientClosingEvent; -import com.aizuda.easy.retry.common.log.EasyRetryLog; -import org.springframework.context.ApplicationListener; -import org.springframework.stereotype.Component; - -/** - * @author xiaowoniu - * @date 2024-03-14 22:00:58 - * @since 3.1.0 - */ -@Component -public class EasyRetryClosingListener implements ApplicationListener { - @Override - public void onApplicationEvent(SnailClientClosingEvent event) { - EasyRetryLog.LOCAL.info("这是一个EasyRetry开始关闭事件"); - } -} diff --git a/src/main/java/com/example/easy/retry/listener/EasyRetryStartedListener.java b/src/main/java/com/example/easy/retry/listener/EasyRetryStartedListener.java deleted file mode 100644 index e91807a..0000000 --- a/src/main/java/com/example/easy/retry/listener/EasyRetryStartedListener.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.example.easy.retry.listener; - -import com.aizuda.easy.retry.client.common.event.SnailClientStartedEvent; -import com.aizuda.easy.retry.common.log.EasyRetryLog; -import org.springframework.context.ApplicationListener; -import org.springframework.stereotype.Component; - -/** - * @author xiaowoniu - * @date 2024-03-14 22:00:58 - * @since 3.1.0 - */ -@Component -public class EasyRetryStartedListener implements ApplicationListener { - @Override - public void onApplicationEvent(SnailClientStartedEvent event) { - EasyRetryLog.LOCAL.info("这是一个EasyRetry启动完成事件"); - } -} diff --git a/src/main/java/com/example/easy/retry/listener/EasyRetryStartingListener.java b/src/main/java/com/example/easy/retry/listener/EasyRetryStartingListener.java deleted file mode 100644 index f2b504f..0000000 --- a/src/main/java/com/example/easy/retry/listener/EasyRetryStartingListener.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.example.easy.retry.listener; - -import com.aizuda.easy.retry.client.common.event.SnailClientStartingEvent; -import com.aizuda.easy.retry.common.log.EasyRetryLog; -import org.springframework.context.ApplicationListener; -import org.springframework.stereotype.Component; - -/** - * @author xiaowoniu - * @date 2024-03-14 22:00:58 - * @since 3.1.0 - */ -@Component -public class EasyRetryStartingListener implements ApplicationListener { - @Override - public void onApplicationEvent(SnailClientStartingEvent event) { - EasyRetryLog.LOCAL.info("这是一个EasyRetry启动事件"); - } -} diff --git a/src/main/java/com/example/easy/retry/EasyRetrySpringbootApplication.java b/src/main/java/com/example/snailjob/SnailJobSpringbootApplication.java similarity index 52% rename from src/main/java/com/example/easy/retry/EasyRetrySpringbootApplication.java rename to src/main/java/com/example/snailjob/SnailJobSpringbootApplication.java index 48df1d7..d75b544 100644 --- a/src/main/java/com/example/easy/retry/EasyRetrySpringbootApplication.java +++ b/src/main/java/com/example/snailjob/SnailJobSpringbootApplication.java @@ -1,6 +1,6 @@ -package com.example.easy.retry; +package com.example.snailjob; -import com.aizuda.easy.retry.client.starter.EnableEasyRetry; +import com.aizuda.snailjob.client.starter.EnableSnailJob; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -8,13 +8,13 @@ import java.util.TimeZone; @SpringBootApplication -@EnableEasyRetry(group = "easy_retry_demo_group") -@MapperScan("com.example.easy.retry.dao") -public class EasyRetrySpringbootApplication { +@EnableSnailJob(group = "snail_job_demo_group") +@MapperScan("com.example.snailjob.dao") +public class SnailJobSpringbootApplication { public static void main(String[] args) { TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai")); - SpringApplication.run(EasyRetrySpringbootApplication.class, args); + SpringApplication.run(SnailJobSpringbootApplication.class, args); } } diff --git a/src/main/java/com/example/snailjob/config/SwaggerConfig.java b/src/main/java/com/example/snailjob/config/SwaggerConfig.java new file mode 100644 index 0000000..4fd3515 --- /dev/null +++ b/src/main/java/com/example/snailjob/config/SwaggerConfig.java @@ -0,0 +1,55 @@ +package com.example.snailjob.config; + +import com.aizuda.snailjob.common.core.util.SnailJobVersion; +import io.swagger.v3.oas.models.ExternalDocumentation; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.info.License; +import org.springdoc.core.models.GroupedOpenApi; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + + +/** + * @author: www.byteblogs.com + * @date : 2023-07-17 18:19 + * @since 2.1.0 + */ +@Configuration +public class SwaggerConfig { + + @Bean + public OpenAPI springShopOpenAPI() { + return new OpenAPI() + .info(new Info() + .title("Snail Job Example") + .description("

SnailJob是致力提高分布式业务系统一致性的分布式重试平台

\n" + + "

官网地址: https://www.easyretry.com/

" + + "

在线体验地址: http://preview.easyretry.com/

" + + "

源码地址: https://gitee.com/byteblogs168/easy-retry-demo

" + + "

特别提醒: 🌻在您使用测试案例之前请认真的阅读官网.

") + .version(SnailJobVersion.getVersion()) + .license(new License().name("Apache 2.0").url("https://www.easyretry.com/"))) + .externalDocs(new ExternalDocumentation() + .description("视频教程:从0到1快速了解分布式重试组件EasyRetry") + .url("https://www.ixigua.com/pseries/7272009348824433213/")) + ; + } + + @Bean + public GroupedOpenApi adminApi() { + return GroupedOpenApi.builder() + //分组名 + .group("user") + .pathsToMatch("/**") + //扫描路径,将路径下有swagger注解的接口解析到文档中 + .packagesToScan("com.example.easy.retry.controller") + .build(); + } +} + + + + + + diff --git a/src/main/java/com/example/easy/retry/controller/LocalAndRemoteRetryController.java b/src/main/java/com/example/snailjob/controller/LocalAndRemoteRetryController.java similarity index 98% rename from src/main/java/com/example/easy/retry/controller/LocalAndRemoteRetryController.java rename to src/main/java/com/example/snailjob/controller/LocalAndRemoteRetryController.java index f27a583..18e6dde 100644 --- a/src/main/java/com/example/easy/retry/controller/LocalAndRemoteRetryController.java +++ b/src/main/java/com/example/snailjob/controller/LocalAndRemoteRetryController.java @@ -1,6 +1,6 @@ -package com.example.easy.retry.controller; +package com.example.snailjob.controller; -import com.example.easy.retry.service.LocalRemoteService; +import com.example.snailjob.service.LocalRemoteService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Schema; diff --git a/src/main/java/com/example/easy/retry/controller/LocalRetryController.java b/src/main/java/com/example/snailjob/controller/LocalRetryController.java similarity index 98% rename from src/main/java/com/example/easy/retry/controller/LocalRetryController.java rename to src/main/java/com/example/snailjob/controller/LocalRetryController.java index 8e741ff..9965f52 100644 --- a/src/main/java/com/example/easy/retry/controller/LocalRetryController.java +++ b/src/main/java/com/example/snailjob/controller/LocalRetryController.java @@ -1,6 +1,6 @@ -package com.example.easy.retry.controller; +package com.example.snailjob.controller; -import com.example.easy.retry.vo.OrderVo; +import com.example.snailjob.vo.OrderVo; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameters; @@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import com.example.easy.retry.service.LocalRetryService; +import com.example.snailjob.service.LocalRetryService; @RestController @RequestMapping("/local") diff --git a/src/main/java/com/example/easy/retry/controller/ManualRetryExecutorController.java b/src/main/java/com/example/snailjob/controller/ManualRetryExecutorController.java similarity index 92% rename from src/main/java/com/example/easy/retry/controller/ManualRetryExecutorController.java rename to src/main/java/com/example/snailjob/controller/ManualRetryExecutorController.java index 7d8f5fa..5b09f96 100644 --- a/src/main/java/com/example/easy/retry/controller/ManualRetryExecutorController.java +++ b/src/main/java/com/example/snailjob/controller/ManualRetryExecutorController.java @@ -1,4 +1,4 @@ -package com.example.easy.retry.controller; +package com.example.snailjob.controller; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import com.example.easy.retry.service.ManualRetryExecutorMethodService; +import com.example.snailjob.service.ManualRetryExecutorMethodService; @RestController @RequestMapping("/manual") diff --git a/src/main/java/com/example/easy/retry/controller/RemoteRetryController.java b/src/main/java/com/example/snailjob/controller/RemoteRetryController.java similarity index 98% rename from src/main/java/com/example/easy/retry/controller/RemoteRetryController.java rename to src/main/java/com/example/snailjob/controller/RemoteRetryController.java index b80f8c9..8f0c4ee 100644 --- a/src/main/java/com/example/easy/retry/controller/RemoteRetryController.java +++ b/src/main/java/com/example/snailjob/controller/RemoteRetryController.java @@ -1,4 +1,4 @@ -package com.example.easy.retry.controller; +package com.example.snailjob.controller; import java.util.Random; import java.util.UUID; @@ -16,8 +16,8 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import com.example.easy.retry.vo.OrderVo; -import com.example.easy.retry.service.RemoteRetryService; +import com.example.snailjob.vo.OrderVo; +import com.example.snailjob.service.RemoteRetryService; @RestController @RequestMapping("/remote") diff --git a/src/main/java/com/example/easy/retry/controller/WorkflowCallbackController.java b/src/main/java/com/example/snailjob/controller/WorkflowCallbackController.java similarity index 86% rename from src/main/java/com/example/easy/retry/controller/WorkflowCallbackController.java rename to src/main/java/com/example/snailjob/controller/WorkflowCallbackController.java index 527ff2b..242a0c9 100644 --- a/src/main/java/com/example/easy/retry/controller/WorkflowCallbackController.java +++ b/src/main/java/com/example/snailjob/controller/WorkflowCallbackController.java @@ -1,6 +1,6 @@ -package com.example.easy.retry.controller; +package com.example.snailjob.controller; -import com.aizuda.easy.retry.server.model.dto.CallbackParamsDTO; +import com.aizuda.snailjob.server.model.dto.CallbackParamsDTO; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpHeaders; diff --git a/src/main/java/com/example/easy/retry/customized/MultiParamIdempotentGenerate.java b/src/main/java/com/example/snailjob/customized/MultiParamIdempotentGenerate.java similarity index 78% rename from src/main/java/com/example/easy/retry/customized/MultiParamIdempotentGenerate.java rename to src/main/java/com/example/snailjob/customized/MultiParamIdempotentGenerate.java index 4df8b22..0ee50bd 100644 --- a/src/main/java/com/example/easy/retry/customized/MultiParamIdempotentGenerate.java +++ b/src/main/java/com/example/snailjob/customized/MultiParamIdempotentGenerate.java @@ -1,8 +1,8 @@ -package com.example.easy.retry.customized; +package com.example.snailjob.customized; -import com.aizuda.easy.retry.client.core.IdempotentIdGenerate; -import com.aizuda.easy.retry.common.core.model.IdempotentIdContext; -import com.example.easy.retry.vo.OrderVo; +import com.aizuda.snailjob.client.core.IdempotentIdGenerate; +import com.aizuda.snailjob.common.core.model.IdempotentIdContext; +import com.example.snailjob.vo.OrderVo; import cn.hutool.crypto.SecureUtil; import lombok.extern.slf4j.Slf4j; diff --git a/src/main/java/com/example/easy/retry/customized/OrderCompleteCallback.java b/src/main/java/com/example/snailjob/customized/OrderCompleteCallback.java similarity index 83% rename from src/main/java/com/example/easy/retry/customized/OrderCompleteCallback.java rename to src/main/java/com/example/snailjob/customized/OrderCompleteCallback.java index 36620b9..024b5fd 100644 --- a/src/main/java/com/example/easy/retry/customized/OrderCompleteCallback.java +++ b/src/main/java/com/example/snailjob/customized/OrderCompleteCallback.java @@ -1,13 +1,12 @@ -package com.example.easy.retry.customized; +package com.example.snailjob.customized; import cn.hutool.json.JSONUtil; -import com.aizuda.easy.retry.client.core.callback.RetryCompleteCallback; -import com.aizuda.easy.retry.common.core.util.JsonUtil; +import com.aizuda.snailjob.client.core.callback.RetryCompleteCallback; +import com.aizuda.snailjob.common.core.util.JsonUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; -import com.example.easy.retry.dao.FailOrderBaseMapper; -import com.example.easy.retry.po.FailOrderPo; -import com.example.easy.retry.vo.OrderVo; +import com.example.snailjob.dao.FailOrderBaseMapper; +import com.example.snailjob.po.FailOrderPo; +import com.example.snailjob.vo.OrderVo; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/example/easy/retry/customized/OrderIdempotentIdGenerate.java b/src/main/java/com/example/snailjob/customized/OrderIdempotentIdGenerate.java similarity index 58% rename from src/main/java/com/example/easy/retry/customized/OrderIdempotentIdGenerate.java rename to src/main/java/com/example/snailjob/customized/OrderIdempotentIdGenerate.java index c08db6b..cb0a015 100644 --- a/src/main/java/com/example/easy/retry/customized/OrderIdempotentIdGenerate.java +++ b/src/main/java/com/example/snailjob/customized/OrderIdempotentIdGenerate.java @@ -1,10 +1,8 @@ -package com.example.easy.retry.customized; +package com.example.snailjob.customized; -import org.apache.catalina.security.SecurityUtil; - -import com.aizuda.easy.retry.client.core.IdempotentIdGenerate; -import com.aizuda.easy.retry.common.core.model.IdempotentIdContext; -import com.example.easy.retry.vo.OrderVo; +import com.aizuda.snailjob.client.core.IdempotentIdGenerate; +import com.aizuda.snailjob.common.core.model.IdempotentIdContext; +import com.example.snailjob.vo.OrderVo; import cn.hutool.crypto.SecureUtil; diff --git a/src/main/java/com/example/easy/retry/customized/OrderRetryMethod.java b/src/main/java/com/example/snailjob/customized/OrderRetryMethod.java similarity index 76% rename from src/main/java/com/example/easy/retry/customized/OrderRetryMethod.java rename to src/main/java/com/example/snailjob/customized/OrderRetryMethod.java index 158be30..ceb6ced 100644 --- a/src/main/java/com/example/easy/retry/customized/OrderRetryMethod.java +++ b/src/main/java/com/example/snailjob/customized/OrderRetryMethod.java @@ -1,11 +1,9 @@ -package com.example.easy.retry.customized; - -import java.lang.reflect.Array; +package com.example.snailjob.customized; import org.springframework.stereotype.Component; -import com.aizuda.easy.retry.client.core.strategy.ExecutorMethod; -import com.example.easy.retry.vo.OrderVo; +import com.aizuda.snailjob.client.core.strategy.ExecutorMethod; +import com.example.snailjob.vo.OrderVo; import cn.hutool.json.JSONUtil; import lombok.extern.slf4j.Slf4j; diff --git a/src/main/java/com/example/easy/retry/customized/SingleParamIdempotentGenerate.java b/src/main/java/com/example/snailjob/customized/SingleParamIdempotentGenerate.java similarity index 62% rename from src/main/java/com/example/easy/retry/customized/SingleParamIdempotentGenerate.java rename to src/main/java/com/example/snailjob/customized/SingleParamIdempotentGenerate.java index a2f1dfd..a025449 100644 --- a/src/main/java/com/example/easy/retry/customized/SingleParamIdempotentGenerate.java +++ b/src/main/java/com/example/snailjob/customized/SingleParamIdempotentGenerate.java @@ -1,8 +1,7 @@ -package com.example.easy.retry.customized; +package com.example.snailjob.customized; -import com.aizuda.easy.retry.client.core.IdempotentIdGenerate; -import com.aizuda.easy.retry.common.core.model.IdempotentIdContext; -import com.example.easy.retry.vo.OrderVo; +import com.aizuda.snailjob.client.core.IdempotentIdGenerate; +import com.aizuda.snailjob.common.core.model.IdempotentIdContext; import cn.hutool.crypto.SecureUtil; diff --git a/src/main/java/com/example/easy/retry/dao/FailOrderBaseMapper.java b/src/main/java/com/example/snailjob/dao/FailOrderBaseMapper.java similarity index 70% rename from src/main/java/com/example/easy/retry/dao/FailOrderBaseMapper.java rename to src/main/java/com/example/snailjob/dao/FailOrderBaseMapper.java index ed4095f..d38c2f9 100644 --- a/src/main/java/com/example/easy/retry/dao/FailOrderBaseMapper.java +++ b/src/main/java/com/example/snailjob/dao/FailOrderBaseMapper.java @@ -1,9 +1,9 @@ -package com.example.easy.retry.dao; +package com.example.snailjob.dao; import org.springframework.stereotype.Repository; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.example.easy.retry.po.FailOrderPo; +import com.example.snailjob.po.FailOrderPo; @Repository public interface FailOrderBaseMapper extends BaseMapper { diff --git a/src/main/java/com/example/easy/retry/exception/BusinessException.java b/src/main/java/com/example/snailjob/exception/BusinessException.java similarity index 79% rename from src/main/java/com/example/easy/retry/exception/BusinessException.java rename to src/main/java/com/example/snailjob/exception/BusinessException.java index e40dff0..9936c31 100644 --- a/src/main/java/com/example/easy/retry/exception/BusinessException.java +++ b/src/main/java/com/example/snailjob/exception/BusinessException.java @@ -1,4 +1,4 @@ -package com.example.easy.retry.exception; +package com.example.snailjob.exception; /** * 业务异常类 diff --git a/src/main/java/com/example/easy/retry/exception/ParamException.java b/src/main/java/com/example/snailjob/exception/ParamException.java similarity index 79% rename from src/main/java/com/example/easy/retry/exception/ParamException.java rename to src/main/java/com/example/snailjob/exception/ParamException.java index 2d93671..a235d05 100644 --- a/src/main/java/com/example/easy/retry/exception/ParamException.java +++ b/src/main/java/com/example/snailjob/exception/ParamException.java @@ -1,4 +1,4 @@ -package com.example.easy.retry.exception; +package com.example.snailjob.exception; /** * 参数异常处理类 */ diff --git a/src/main/java/com/example/easy/retry/executor/ManualRetryExecutorTask.java b/src/main/java/com/example/snailjob/executor/ManualRetryExecutorTask.java similarity index 75% rename from src/main/java/com/example/easy/retry/executor/ManualRetryExecutorTask.java rename to src/main/java/com/example/snailjob/executor/ManualRetryExecutorTask.java index 8057729..5ac2b30 100644 --- a/src/main/java/com/example/easy/retry/executor/ManualRetryExecutorTask.java +++ b/src/main/java/com/example/snailjob/executor/ManualRetryExecutorTask.java @@ -1,8 +1,8 @@ -package com.example.easy.retry.executor; +package com.example.snailjob.executor; -import com.aizuda.easy.retry.client.core.annotation.ExecutorMethodRegister; -import com.aizuda.easy.retry.client.core.strategy.ExecutorMethod; -import com.example.easy.retry.vo.OrderVo; +import com.aizuda.snailjob.client.core.annotation.ExecutorMethodRegister; +import com.aizuda.snailjob.client.core.strategy.ExecutorMethod; +import com.example.snailjob.vo.OrderVo; import cn.hutool.json.JSONUtil; import lombok.extern.slf4j.Slf4j; diff --git a/src/main/java/com/example/easy/retry/handler/LocalAndRemoteRetryHandler.java b/src/main/java/com/example/snailjob/handler/LocalAndRemoteRetryHandler.java similarity index 88% rename from src/main/java/com/example/easy/retry/handler/LocalAndRemoteRetryHandler.java rename to src/main/java/com/example/snailjob/handler/LocalAndRemoteRetryHandler.java index 3be4d28..b5dfdf5 100644 --- a/src/main/java/com/example/easy/retry/handler/LocalAndRemoteRetryHandler.java +++ b/src/main/java/com/example/snailjob/handler/LocalAndRemoteRetryHandler.java @@ -1,8 +1,8 @@ -package com.example.easy.retry.handler; +package com.example.snailjob.handler; -import com.aizuda.easy.retry.client.core.annotation.Propagation; -import com.aizuda.easy.retry.client.core.annotation.Retryable; -import com.aizuda.easy.retry.client.core.retryer.RetryType; +import com.aizuda.snailjob.client.core.annotation.Propagation; +import com.aizuda.snailjob.client.core.annotation.Retryable; +import com.aizuda.snailjob.client.core.retryer.RetryType; import org.springframework.stereotype.Component; import java.util.Random; diff --git a/src/main/java/com/example/easy/retry/handler/OnlyLocalRetryHandler.java b/src/main/java/com/example/snailjob/handler/OnlyLocalRetryHandler.java similarity index 88% rename from src/main/java/com/example/easy/retry/handler/OnlyLocalRetryHandler.java rename to src/main/java/com/example/snailjob/handler/OnlyLocalRetryHandler.java index 3696c74..aa8d39d 100644 --- a/src/main/java/com/example/easy/retry/handler/OnlyLocalRetryHandler.java +++ b/src/main/java/com/example/snailjob/handler/OnlyLocalRetryHandler.java @@ -1,8 +1,8 @@ -package com.example.easy.retry.handler; +package com.example.snailjob.handler; -import com.aizuda.easy.retry.client.core.annotation.Propagation; -import com.aizuda.easy.retry.client.core.annotation.Retryable; -import com.aizuda.easy.retry.client.core.retryer.RetryType; +import com.aizuda.snailjob.client.core.annotation.Propagation; +import com.aizuda.snailjob.client.core.annotation.Retryable; +import com.aizuda.snailjob.client.core.retryer.RetryType; import org.springframework.stereotype.Component; import java.util.Random; diff --git a/src/main/java/com/example/easy/retry/handler/OnlyRemoteRetryHandler.java b/src/main/java/com/example/snailjob/handler/OnlyRemoteRetryHandler.java similarity index 88% rename from src/main/java/com/example/easy/retry/handler/OnlyRemoteRetryHandler.java rename to src/main/java/com/example/snailjob/handler/OnlyRemoteRetryHandler.java index 6872021..9ccb979 100644 --- a/src/main/java/com/example/easy/retry/handler/OnlyRemoteRetryHandler.java +++ b/src/main/java/com/example/snailjob/handler/OnlyRemoteRetryHandler.java @@ -1,8 +1,8 @@ -package com.example.easy.retry.handler; +package com.example.snailjob.handler; -import com.aizuda.easy.retry.client.core.annotation.Propagation; -import com.aizuda.easy.retry.client.core.annotation.Retryable; -import com.aizuda.easy.retry.client.core.retryer.RetryType; +import com.aizuda.snailjob.client.core.annotation.Propagation; +import com.aizuda.snailjob.client.core.annotation.Retryable; +import com.aizuda.snailjob.client.core.retryer.RetryType; import org.springframework.stereotype.Component; import java.util.Random; diff --git a/src/main/java/com/example/easy/retry/job/TestAnnoJobExecutor.java b/src/main/java/com/example/snailjob/job/TestAnnoJobExecutor.java similarity index 60% rename from src/main/java/com/example/easy/retry/job/TestAnnoJobExecutor.java rename to src/main/java/com/example/snailjob/job/TestAnnoJobExecutor.java index e701c9e..f75aa64 100644 --- a/src/main/java/com/example/easy/retry/job/TestAnnoJobExecutor.java +++ b/src/main/java/com/example/snailjob/job/TestAnnoJobExecutor.java @@ -1,8 +1,8 @@ -package com.example.easy.retry.job; +package com.example.snailjob.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.snailjob.client.job.core.annotation.JobExecutor; +import com.aizuda.snailjob.client.job.core.dto.JobArgs; +import com.aizuda.snailjob.client.model.ExecuteResult; import org.springframework.stereotype.Component; /** diff --git a/src/main/java/com/example/easy/retry/job/TestAnnoJobExecutorSleep10s.java b/src/main/java/com/example/snailjob/job/TestAnnoJobExecutorSleep10s.java similarity index 67% rename from src/main/java/com/example/easy/retry/job/TestAnnoJobExecutorSleep10s.java rename to src/main/java/com/example/snailjob/job/TestAnnoJobExecutorSleep10s.java index 5e7a327..4284e8a 100644 --- a/src/main/java/com/example/easy/retry/job/TestAnnoJobExecutorSleep10s.java +++ b/src/main/java/com/example/snailjob/job/TestAnnoJobExecutorSleep10s.java @@ -1,9 +1,9 @@ -package com.example.easy.retry.job; +package com.example.snailjob.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 com.aizuda.snailjob.client.job.core.annotation.JobExecutor; +import com.aizuda.snailjob.client.job.core.dto.JobArgs; +import com.aizuda.snailjob.client.model.ExecuteResult; +import com.aizuda.snailjob.common.core.util.JsonUtil; import org.springframework.stereotype.Component; /** diff --git a/src/main/java/com/example/easy/retry/job/TestAnnoJobExecutorSleep1s.java b/src/main/java/com/example/snailjob/job/TestAnnoJobExecutorSleep1s.java similarity index 66% rename from src/main/java/com/example/easy/retry/job/TestAnnoJobExecutorSleep1s.java rename to src/main/java/com/example/snailjob/job/TestAnnoJobExecutorSleep1s.java index 00e0de9..0225d86 100644 --- a/src/main/java/com/example/easy/retry/job/TestAnnoJobExecutorSleep1s.java +++ b/src/main/java/com/example/snailjob/job/TestAnnoJobExecutorSleep1s.java @@ -1,9 +1,9 @@ -package com.example.easy.retry.job; +package com.example.snailjob.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 com.aizuda.snailjob.client.job.core.annotation.JobExecutor; +import com.aizuda.snailjob.client.job.core.dto.JobArgs; +import com.aizuda.snailjob.client.model.ExecuteResult; +import com.aizuda.snailjob.common.core.util.JsonUtil; import org.springframework.stereotype.Component; /** diff --git a/src/main/java/com/example/easy/retry/job/TestAnnoJobExecutorSleep30s.java b/src/main/java/com/example/snailjob/job/TestAnnoJobExecutorSleep30s.java similarity index 67% rename from src/main/java/com/example/easy/retry/job/TestAnnoJobExecutorSleep30s.java rename to src/main/java/com/example/snailjob/job/TestAnnoJobExecutorSleep30s.java index 14f3591..3ccefe0 100644 --- a/src/main/java/com/example/easy/retry/job/TestAnnoJobExecutorSleep30s.java +++ b/src/main/java/com/example/snailjob/job/TestAnnoJobExecutorSleep30s.java @@ -1,9 +1,9 @@ -package com.example.easy.retry.job; +package com.example.snailjob.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 com.aizuda.snailjob.client.job.core.annotation.JobExecutor; +import com.aizuda.snailjob.client.job.core.dto.JobArgs; +import com.aizuda.snailjob.client.model.ExecuteResult; +import com.aizuda.snailjob.common.core.util.JsonUtil; import org.springframework.stereotype.Component; /** diff --git a/src/main/java/com/example/easy/retry/job/TestAnnoJobExecutorSleep5s.java b/src/main/java/com/example/snailjob/job/TestAnnoJobExecutorSleep5s.java similarity index 69% rename from src/main/java/com/example/easy/retry/job/TestAnnoJobExecutorSleep5s.java rename to src/main/java/com/example/snailjob/job/TestAnnoJobExecutorSleep5s.java index fcbe664..27c56cd 100644 --- a/src/main/java/com/example/easy/retry/job/TestAnnoJobExecutorSleep5s.java +++ b/src/main/java/com/example/snailjob/job/TestAnnoJobExecutorSleep5s.java @@ -1,9 +1,9 @@ -package com.example.easy.retry.job; +package com.example.snailjob.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 com.aizuda.snailjob.client.job.core.annotation.JobExecutor; +import com.aizuda.snailjob.client.job.core.dto.JobArgs; +import com.aizuda.snailjob.client.model.ExecuteResult; +import com.aizuda.snailjob.common.core.util.JsonUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/com/example/easy/retry/job/TestBroadcastJobExecutor.java b/src/main/java/com/example/snailjob/job/TestBroadcastJobExecutor.java similarity index 65% rename from src/main/java/com/example/easy/retry/job/TestBroadcastJobExecutor.java rename to src/main/java/com/example/snailjob/job/TestBroadcastJobExecutor.java index 4bb9190..25eb3f9 100644 --- a/src/main/java/com/example/easy/retry/job/TestBroadcastJobExecutor.java +++ b/src/main/java/com/example/snailjob/job/TestBroadcastJobExecutor.java @@ -1,4 +1,4 @@ -package com.example.easy.retry.job; +package com.example.snailjob.job; /** * @author zhengweilin @@ -6,11 +6,11 @@ * @date 2024/01/22 */ -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 com.example.easy.retry.po.FailOrderPo; +import com.aizuda.snailjob.client.job.core.annotation.JobExecutor; +import com.aizuda.snailjob.client.job.core.dto.JobArgs; +import com.aizuda.snailjob.client.model.ExecuteResult; +import com.aizuda.snailjob.common.core.util.JsonUtil; +import com.example.snailjob.po.FailOrderPo; import org.springframework.stereotype.Component; import java.util.Random; diff --git a/src/main/java/com/example/easy/retry/job/TestClassJobExecutor.java b/src/main/java/com/example/snailjob/job/TestClassJobExecutor.java similarity index 61% rename from src/main/java/com/example/easy/retry/job/TestClassJobExecutor.java rename to src/main/java/com/example/snailjob/job/TestClassJobExecutor.java index 4029b73..8a70a36 100644 --- a/src/main/java/com/example/easy/retry/job/TestClassJobExecutor.java +++ b/src/main/java/com/example/snailjob/job/TestClassJobExecutor.java @@ -1,8 +1,8 @@ -package com.example.easy.retry.job; +package com.example.snailjob.job; -import com.aizuda.easy.retry.client.job.core.dto.JobArgs; -import com.aizuda.easy.retry.client.job.core.executor.AbstractJobExecutor; -import com.aizuda.easy.retry.client.model.ExecuteResult; +import com.aizuda.snailjob.client.job.core.dto.JobArgs; +import com.aizuda.snailjob.client.job.core.executor.AbstractJobExecutor; +import com.aizuda.snailjob.client.model.ExecuteResult; import org.springframework.stereotype.Component; /** diff --git a/src/main/java/com/example/easy/retry/job/TestPartitionJobExecutor.java b/src/main/java/com/example/snailjob/job/TestPartitionJobExecutor.java similarity index 68% rename from src/main/java/com/example/easy/retry/job/TestPartitionJobExecutor.java rename to src/main/java/com/example/snailjob/job/TestPartitionJobExecutor.java index 3b797ec..b82bb91 100644 --- a/src/main/java/com/example/easy/retry/job/TestPartitionJobExecutor.java +++ b/src/main/java/com/example/snailjob/job/TestPartitionJobExecutor.java @@ -1,4 +1,4 @@ -package com.example.easy.retry.job; +package com.example.snailjob.job; /** * @author zhengweilin @@ -6,10 +6,10 @@ * @date 2024/01/22 */ -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 com.aizuda.snailjob.client.job.core.annotation.JobExecutor; +import com.aizuda.snailjob.client.job.core.dto.JobArgs; +import com.aizuda.snailjob.client.model.ExecuteResult; +import com.example.snailjob.po.FailOrderPo; import org.springframework.stereotype.Component; @Component diff --git a/src/main/java/com/example/easy/retry/job/TestWorkflowAnnoJobExecutor.java b/src/main/java/com/example/snailjob/job/TestWorkflowAnnoJobExecutor.java similarity index 52% rename from src/main/java/com/example/easy/retry/job/TestWorkflowAnnoJobExecutor.java rename to src/main/java/com/example/snailjob/job/TestWorkflowAnnoJobExecutor.java index 73ac177..4914da1 100644 --- a/src/main/java/com/example/easy/retry/job/TestWorkflowAnnoJobExecutor.java +++ b/src/main/java/com/example/snailjob/job/TestWorkflowAnnoJobExecutor.java @@ -1,11 +1,11 @@ -package com.example.easy.retry.job; +package com.example.snailjob.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 com.aizuda.easy.retry.common.log.EasyRetryLog; -import com.example.easy.retry.po.FailOrderPo; +import com.aizuda.snailjob.client.job.core.annotation.JobExecutor; +import com.aizuda.snailjob.client.job.core.dto.JobArgs; +import com.aizuda.snailjob.client.model.ExecuteResult; +import com.aizuda.snailjob.common.core.util.JsonUtil; +import com.aizuda.snailjob.common.log.SnailJobLog; +import com.example.snailjob.po.FailOrderPo; import org.springframework.stereotype.Component; /** @@ -19,7 +19,7 @@ public class TestWorkflowAnnoJobExecutor { public ExecuteResult jobExecute(JobArgs jobArgs) throws InterruptedException { // for (int i = 0; i < 30; i++) { -// EasyRetryLog.REMOTE.info("任务执行开始. [{}]", i + "" + JsonUtil.toJsonString(jobArgs)); +// SnailJobLog.REMOTE.info("任务执行开始. [{}]", i + "" + JsonUtil.toJsonString(jobArgs)); // } FailOrderPo failOrderPo = new FailOrderPo(); failOrderPo.setOrderId("xiaowoniu"); diff --git a/src/main/java/com/example/snailjob/listener/SnailJobChannelReconnectListener.java b/src/main/java/com/example/snailjob/listener/SnailJobChannelReconnectListener.java new file mode 100644 index 0000000..449f5ea --- /dev/null +++ b/src/main/java/com/example/snailjob/listener/SnailJobChannelReconnectListener.java @@ -0,0 +1,19 @@ +package com.example.snailjob.listener; + +import com.aizuda.snailjob.client.common.event.SnailChannelReconnectEvent; +import com.aizuda.snailjob.common.log.SnailJobLog; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +/** + * @author xiaowoniu + * @date 2024-03-14 21:58:18 + * @since 3.1.0 + */ +@Component +public class SnailJobChannelReconnectListener implements ApplicationListener { + @Override + public void onApplicationEvent(SnailChannelReconnectEvent event) { + SnailJobLog.LOCAL.info("这个一个重连事件"); + } +} diff --git a/src/main/java/com/example/snailjob/listener/SnailJobClosedListener.java b/src/main/java/com/example/snailjob/listener/SnailJobClosedListener.java new file mode 100644 index 0000000..76dbece --- /dev/null +++ b/src/main/java/com/example/snailjob/listener/SnailJobClosedListener.java @@ -0,0 +1,19 @@ +package com.example.snailjob.listener; + +import com.aizuda.snailjob.client.common.event.SnailClientClosedEvent; +import com.aizuda.snailjob.common.log.SnailJobLog; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +/** + * @author xiaowoniu + * @date 2024-03-14 22:00:58 + * @since 3.1.0 + */ +@Component +public class SnailJobClosedListener implements ApplicationListener { + @Override + public void onApplicationEvent(SnailClientClosedEvent event) { + SnailJobLog.LOCAL.info("这是一个SnailJob关闭完成事件"); + } +} diff --git a/src/main/java/com/example/snailjob/listener/SnailJobClosingListener.java b/src/main/java/com/example/snailjob/listener/SnailJobClosingListener.java new file mode 100644 index 0000000..c2188d5 --- /dev/null +++ b/src/main/java/com/example/snailjob/listener/SnailJobClosingListener.java @@ -0,0 +1,19 @@ +package com.example.snailjob.listener; + +import com.aizuda.snailjob.client.common.event.SnailClientClosingEvent; +import com.aizuda.snailjob.common.log.SnailJobLog; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +/** + * @author xiaowoniu + * @date 2024-03-14 22:00:58 + * @since 3.1.0 + */ +@Component +public class SnailJobClosingListener implements ApplicationListener { + @Override + public void onApplicationEvent(SnailClientClosingEvent event) { + SnailJobLog.LOCAL.info("这是一个SnailJob开始关闭事件"); + } +} diff --git a/src/main/java/com/example/snailjob/listener/SnailJobStartedListener.java b/src/main/java/com/example/snailjob/listener/SnailJobStartedListener.java new file mode 100644 index 0000000..4a6a78d --- /dev/null +++ b/src/main/java/com/example/snailjob/listener/SnailJobStartedListener.java @@ -0,0 +1,19 @@ +package com.example.snailjob.listener; + +import com.aizuda.snailjob.client.common.event.SnailClientStartedEvent; +import com.aizuda.snailjob.common.log.SnailJobLog; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +/** + * @author xiaowoniu + * @date 2024-03-14 22:00:58 + * @since 3.1.0 + */ +@Component +public class SnailJobStartedListener implements ApplicationListener { + @Override + public void onApplicationEvent(SnailClientStartedEvent event) { + SnailJobLog.LOCAL.info("这是一个SnailJob启动完成事件"); + } +} diff --git a/src/main/java/com/example/snailjob/listener/SnailJobStartingListener.java b/src/main/java/com/example/snailjob/listener/SnailJobStartingListener.java new file mode 100644 index 0000000..57c4b95 --- /dev/null +++ b/src/main/java/com/example/snailjob/listener/SnailJobStartingListener.java @@ -0,0 +1,19 @@ +package com.example.snailjob.listener; + +import com.aizuda.snailjob.client.common.event.SnailClientStartingEvent; +import com.aizuda.snailjob.common.log.SnailJobLog; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +/** + * @author xiaowoniu + * @date 2024-03-14 22:00:58 + * @since 3.1.0 + */ +@Component +public class SnailJobStartingListener implements ApplicationListener { + @Override + public void onApplicationEvent(SnailClientStartingEvent event) { + SnailJobLog.LOCAL.info("这是一个SnailJob启动事件"); + } +} diff --git a/src/main/java/com/example/easy/retry/po/FailOrderPo.java b/src/main/java/com/example/snailjob/po/FailOrderPo.java similarity index 96% rename from src/main/java/com/example/easy/retry/po/FailOrderPo.java rename to src/main/java/com/example/snailjob/po/FailOrderPo.java index ec730c6..4ce123d 100644 --- a/src/main/java/com/example/easy/retry/po/FailOrderPo.java +++ b/src/main/java/com/example/snailjob/po/FailOrderPo.java @@ -1,4 +1,4 @@ -package com.example.easy.retry.po; +package com.example.snailjob.po; import java.time.LocalDateTime; diff --git a/src/main/java/com/example/easy/retry/service/LocalRemoteService.java b/src/main/java/com/example/snailjob/service/LocalRemoteService.java similarity index 92% rename from src/main/java/com/example/easy/retry/service/LocalRemoteService.java rename to src/main/java/com/example/snailjob/service/LocalRemoteService.java index 58b8a3f..c8216ef 100644 --- a/src/main/java/com/example/easy/retry/service/LocalRemoteService.java +++ b/src/main/java/com/example/snailjob/service/LocalRemoteService.java @@ -1,4 +1,4 @@ -package com.example.easy.retry.service; +package com.example.snailjob.service; /** * @author: www.byteblogs.com diff --git a/src/main/java/com/example/easy/retry/service/LocalRetryService.java b/src/main/java/com/example/snailjob/service/LocalRetryService.java similarity index 80% rename from src/main/java/com/example/easy/retry/service/LocalRetryService.java rename to src/main/java/com/example/snailjob/service/LocalRetryService.java index 98e762a..ba437c5 100644 --- a/src/main/java/com/example/easy/retry/service/LocalRetryService.java +++ b/src/main/java/com/example/snailjob/service/LocalRetryService.java @@ -1,8 +1,8 @@ -package com.example.easy.retry.service; +package com.example.snailjob.service; -import com.aizuda.easy.retry.client.core.annotation.Retryable; -import com.aizuda.easy.retry.client.core.retryer.RetryType; -import com.example.easy.retry.vo.OrderVo; +import com.aizuda.snailjob.client.core.annotation.Retryable; +import com.aizuda.snailjob.client.core.retryer.RetryType; +import com.example.snailjob.vo.OrderVo; /** * @author: www.byteblogs.com diff --git a/src/main/java/com/example/easy/retry/service/ManualRetryExecutorMethodService.java b/src/main/java/com/example/snailjob/service/ManualRetryExecutorMethodService.java similarity index 80% rename from src/main/java/com/example/easy/retry/service/ManualRetryExecutorMethodService.java rename to src/main/java/com/example/snailjob/service/ManualRetryExecutorMethodService.java index 9f2e589..9d7a075 100644 --- a/src/main/java/com/example/easy/retry/service/ManualRetryExecutorMethodService.java +++ b/src/main/java/com/example/snailjob/service/ManualRetryExecutorMethodService.java @@ -1,4 +1,4 @@ -package com.example.easy.retry.service; +package com.example.snailjob.service; /** * @author: www.byteblogs.com diff --git a/src/main/java/com/example/easy/retry/service/RemoteRetryService.java b/src/main/java/com/example/snailjob/service/RemoteRetryService.java similarity index 91% rename from src/main/java/com/example/easy/retry/service/RemoteRetryService.java rename to src/main/java/com/example/snailjob/service/RemoteRetryService.java index e661715..e58735f 100644 --- a/src/main/java/com/example/easy/retry/service/RemoteRetryService.java +++ b/src/main/java/com/example/snailjob/service/RemoteRetryService.java @@ -1,6 +1,6 @@ -package com.example.easy.retry.service; +package com.example.snailjob.service; -import com.example.easy.retry.vo.OrderVo; +import com.example.snailjob.vo.OrderVo; /** * @author: www.byteblogs.com diff --git a/src/main/java/com/example/easy/retry/service/impl/LocalRemoteServiceImpl.java b/src/main/java/com/example/snailjob/service/impl/LocalRemoteServiceImpl.java similarity index 91% rename from src/main/java/com/example/easy/retry/service/impl/LocalRemoteServiceImpl.java rename to src/main/java/com/example/snailjob/service/impl/LocalRemoteServiceImpl.java index a561d46..578da01 100644 --- a/src/main/java/com/example/easy/retry/service/impl/LocalRemoteServiceImpl.java +++ b/src/main/java/com/example/snailjob/service/impl/LocalRemoteServiceImpl.java @@ -1,9 +1,9 @@ -package com.example.easy.retry.service.impl; +package com.example.snailjob.service.impl; -import com.aizuda.easy.retry.client.core.annotation.Retryable; -import com.aizuda.easy.retry.client.core.retryer.RetryType; -import com.example.easy.retry.handler.LocalAndRemoteRetryHandler; -import com.example.easy.retry.service.LocalRemoteService; +import com.aizuda.snailjob.client.core.annotation.Retryable; +import com.aizuda.snailjob.client.core.retryer.RetryType; +import com.example.snailjob.handler.LocalAndRemoteRetryHandler; +import com.example.snailjob.service.LocalRemoteService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; diff --git a/src/main/java/com/example/easy/retry/service/impl/LocalRetryServiceImpl.java b/src/main/java/com/example/snailjob/service/impl/LocalRetryServiceImpl.java similarity index 92% rename from src/main/java/com/example/easy/retry/service/impl/LocalRetryServiceImpl.java rename to src/main/java/com/example/snailjob/service/impl/LocalRetryServiceImpl.java index da889b8..ed3e290 100644 --- a/src/main/java/com/example/easy/retry/service/impl/LocalRetryServiceImpl.java +++ b/src/main/java/com/example/snailjob/service/impl/LocalRetryServiceImpl.java @@ -1,19 +1,19 @@ -package com.example.easy.retry.service.impl; - -import com.aizuda.easy.retry.client.core.retryer.RetryType; -import com.example.easy.retry.customized.OrderRetryMethod; -import com.example.easy.retry.handler.OnlyLocalRetryHandler; -import com.example.easy.retry.service.LocalRetryService; -import com.example.easy.retry.vo.OrderVo; +package com.example.snailjob.service.impl; + +import com.aizuda.snailjob.client.core.retryer.RetryType; +import com.example.snailjob.customized.OrderRetryMethod; +import com.example.snailjob.handler.OnlyLocalRetryHandler; +import com.example.snailjob.service.LocalRetryService; +import com.example.snailjob.vo.OrderVo; +import com.example.snailjob.exception.ParamException; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import com.aizuda.easy.retry.client.core.annotation.Retryable; -import com.example.easy.retry.exception.ParamException; +import com.aizuda.snailjob.client.core.annotation.Retryable; /** - * easy-retry中的本地重试demo + * snail-job中的本地重试demo */ @Component diff --git a/src/main/java/com/example/easy/retry/service/impl/ManualRetryExecutorMethodServiceImpl.java b/src/main/java/com/example/snailjob/service/impl/ManualRetryExecutorMethodServiceImpl.java similarity index 55% rename from src/main/java/com/example/easy/retry/service/impl/ManualRetryExecutorMethodServiceImpl.java rename to src/main/java/com/example/snailjob/service/impl/ManualRetryExecutorMethodServiceImpl.java index 31707ec..95b6b1c 100644 --- a/src/main/java/com/example/easy/retry/service/impl/ManualRetryExecutorMethodServiceImpl.java +++ b/src/main/java/com/example/snailjob/service/impl/ManualRetryExecutorMethodServiceImpl.java @@ -1,15 +1,14 @@ -package com.example.easy.retry.service.impl; +package com.example.snailjob.service.impl; -import com.example.easy.retry.service.ManualRetryExecutorMethodService; +import com.aizuda.snailjob.client.core.retryer.RetryTaskTemplateBuilder; +import com.aizuda.snailjob.client.core.retryer.SnailJobTemplate; +import com.example.snailjob.executor.ManualRetryExecutorTask; +import com.example.snailjob.service.ManualRetryExecutorMethodService; +import com.example.snailjob.vo.OrderVo; import org.springframework.stereotype.Component; -import com.aizuda.easy.retry.client.core.retryer.EasyRetryTemplate; -import com.aizuda.easy.retry.client.core.retryer.RetryTaskTemplateBuilder; -import com.example.easy.retry.executor.ManualRetryExecutorTask; -import com.example.easy.retry.vo.OrderVo; - /** - * easy-retry中的手动重试 + * snail-job中的手动重试 */ @Component public class ManualRetryExecutorMethodServiceImpl implements ManualRetryExecutorMethodService { @@ -19,7 +18,7 @@ public void myExecutorMethod(String params) { .orderId(params) .source(1) .build(); - EasyRetryTemplate easyRetryTemplate = RetryTaskTemplateBuilder.newBuilder() + SnailJobTemplate snailJobTemplate = RetryTaskTemplateBuilder.newBuilder() // 手动指定场景名称 .withScene(ManualRetryExecutorTask.SCENE) // 指定要执行的任务 @@ -28,7 +27,7 @@ public void myExecutorMethod(String params) { .withParam(orderVo) .build(); // 执行模板 - easyRetryTemplate.executeRetry(); + snailJobTemplate.executeRetry(); } } diff --git a/src/main/java/com/example/easy/retry/service/impl/RemoteRetryServiceImpl.java b/src/main/java/com/example/snailjob/service/impl/RemoteRetryServiceImpl.java similarity index 85% rename from src/main/java/com/example/easy/retry/service/impl/RemoteRetryServiceImpl.java rename to src/main/java/com/example/snailjob/service/impl/RemoteRetryServiceImpl.java index 4623e32..1e0c28d 100644 --- a/src/main/java/com/example/easy/retry/service/impl/RemoteRetryServiceImpl.java +++ b/src/main/java/com/example/snailjob/service/impl/RemoteRetryServiceImpl.java @@ -1,28 +1,27 @@ -package com.example.easy.retry.service.impl; +package com.example.snailjob.service.impl; -import java.util.Random; import java.util.concurrent.TimeUnit; import cn.hutool.core.lang.Assert; -import com.aizuda.easy.retry.client.core.intercepter.RetrySiteSnapshot; -import com.aizuda.easy.retry.common.core.enums.RetryStatusEnum; -import com.example.easy.retry.handler.OnlyRemoteRetryHandler; -import com.example.easy.retry.service.RemoteRetryService; +import com.aizuda.snailjob.client.core.intercepter.RetrySiteSnapshot; +import com.aizuda.snailjob.common.core.enums.RetryStatusEnum; +import com.example.snailjob.handler.OnlyRemoteRetryHandler; +import com.example.snailjob.service.RemoteRetryService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; -import com.aizuda.easy.retry.client.core.annotation.Retryable; -import com.aizuda.easy.retry.client.core.retryer.RetryType; -import com.example.easy.retry.customized.MultiParamIdempotentGenerate; -import com.example.easy.retry.customized.OrderIdempotentIdGenerate; -import com.example.easy.retry.customized.OrderCompleteCallback; -import com.example.easy.retry.customized.OrderRetryMethod; -import com.example.easy.retry.customized.SingleParamIdempotentGenerate; -import com.example.easy.retry.vo.OrderVo; +import com.aizuda.snailjob.client.core.annotation.Retryable; +import com.aizuda.snailjob.client.core.retryer.RetryType; +import com.example.snailjob.customized.MultiParamIdempotentGenerate; +import com.example.snailjob.customized.OrderIdempotentIdGenerate; +import com.example.snailjob.customized.OrderCompleteCallback; +import com.example.snailjob.customized.OrderRetryMethod; +import com.example.snailjob.customized.SingleParamIdempotentGenerate; +import com.example.snailjob.vo.OrderVo; /** - * easy-retry中的远程重试 + * snail-job中的远程重试 */ @Component @Slf4j diff --git a/src/main/java/com/example/easy/retry/spi/MyEasyRetryListener.java b/src/main/java/com/example/snailjob/spi/MySnailJobListener.java similarity index 81% rename from src/main/java/com/example/easy/retry/spi/MyEasyRetryListener.java rename to src/main/java/com/example/snailjob/spi/MySnailJobListener.java index 90fd09b..a6b31ad 100644 --- a/src/main/java/com/example/easy/retry/spi/MyEasyRetryListener.java +++ b/src/main/java/com/example/snailjob/spi/MySnailJobListener.java @@ -1,7 +1,7 @@ -package com.example.easy.retry.spi; +package com.example.snailjob.spi; -import com.aizuda.easy.retry.client.core.event.EasyRetryListener; -import com.aizuda.easy.retry.common.core.util.JsonUtil; +import com.aizuda.snailjob.client.core.event.SnailJobListener; +import com.aizuda.snailjob.common.core.util.JsonUtil; import lombok.extern.slf4j.Slf4j; /** @@ -9,7 +9,7 @@ * @date : 2023-08-28 11:20 */ @Slf4j -public class MyEasyRetryListener implements EasyRetryListener { +public class MySnailJobListener implements SnailJobListener { @Override public void beforeRetry(final String sceneName, final String executorClassName, final Object[] params) { diff --git a/src/main/java/com/example/easy/retry/spi/TTLRetrySiteSnapshotContext.java b/src/main/java/com/example/snailjob/spi/TTLRetrySiteSnapshotContext.java similarity index 85% rename from src/main/java/com/example/easy/retry/spi/TTLRetrySiteSnapshotContext.java rename to src/main/java/com/example/snailjob/spi/TTLRetrySiteSnapshotContext.java index 9627171..2bf3ae5 100644 --- a/src/main/java/com/example/easy/retry/spi/TTLRetrySiteSnapshotContext.java +++ b/src/main/java/com/example/snailjob/spi/TTLRetrySiteSnapshotContext.java @@ -1,6 +1,6 @@ -package com.example.easy.retry.spi; +package com.example.snailjob.spi; -import com.aizuda.easy.retry.client.core.RetrySiteSnapshotContext; +import com.aizuda.snailjob.client.core.RetrySiteSnapshotContext; import com.alibaba.ttl.TransmittableThreadLocal; /** diff --git a/src/main/java/com/example/easy/retry/util/CodeGen.java b/src/main/java/com/example/snailjob/util/CodeGen.java similarity index 59% rename from src/main/java/com/example/easy/retry/util/CodeGen.java rename to src/main/java/com/example/snailjob/util/CodeGen.java index 47e652c..3d3343e 100644 --- a/src/main/java/com/example/easy/retry/util/CodeGen.java +++ b/src/main/java/com/example/snailjob/util/CodeGen.java @@ -1,6 +1,4 @@ -package com.example.easy.retry.util; - -import org.springframework.beans.factory.annotation.Value; +package com.example.snailjob.util; import com.baomidou.mybatisplus.generator.AutoGenerator; import com.baomidou.mybatisplus.generator.config.DataSourceConfig; @@ -10,37 +8,37 @@ public class CodeGen { - private static String dataSourceUrl = "jdbc:mysql://localhost:3306/easy_retry_260?useSSL=false&characterEncoding=utf8&useUnicode=true"; + private static String dataSourceUrl = "jdbc:mysql://localhost:3306/snail_job_260?useSSL=false&characterEncoding=utf8&useUnicode=true"; private static String userName = "root"; - private static String password= "root"; + private static String password = "root"; public static void main(String[] args) { DataSourceConfig dataSourceConfig = new DataSourceConfig.Builder(dataSourceUrl, userName, password).build(); // 全局配置 GlobalConfig globalConfig = new GlobalConfig.Builder() - .outputDir("src/main/java") - .author("xiaowoniu") - .build(); + .outputDir("src/main/java") + .author("xiaowoniu") + .build(); // 策略配置 StrategyConfig strategyConfig = new StrategyConfig.Builder() - .addInclude("workflow") // 需要生成的表名 - .build(); + .addInclude("workflow") // 需要生成的表名 + .build(); // 包配置 PackageConfig packageConfig = new PackageConfig.Builder() - .parent("com.aizuda.easy.retry.template.datasource.persistence.po") - .moduleName("easy-retry-springboot") - .build(); + .parent("com.aizuda.snailjob.template.datasource.persistence.po") + .moduleName("snail-job-springboot") + .build(); // 代码生成器 AutoGenerator generator = new AutoGenerator(dataSourceConfig) - .global(globalConfig) - .strategy(strategyConfig) - .packageInfo(packageConfig); + .global(globalConfig) + .strategy(strategyConfig) + .packageInfo(packageConfig); // 执行生成代码 generator.execute(); diff --git a/src/main/java/com/example/easy/retry/vo/OrderVo.java b/src/main/java/com/example/snailjob/vo/OrderVo.java similarity index 95% rename from src/main/java/com/example/easy/retry/vo/OrderVo.java rename to src/main/java/com/example/snailjob/vo/OrderVo.java index 26c34f4..0b8b1a2 100644 --- a/src/main/java/com/example/easy/retry/vo/OrderVo.java +++ b/src/main/java/com/example/snailjob/vo/OrderVo.java @@ -1,4 +1,4 @@ -package com.example.easy.retry.vo; +package com.example.snailjob.vo; import java.math.BigDecimal; import java.time.LocalDateTime; diff --git a/src/main/resources/META-INF/services/com.aizuda.easy.retry.client.core.ExpressionEngine b/src/main/resources/META-INF/services/com.aizuda.easy.retry.client.core.ExpressionEngine deleted file mode 100644 index b4e8fd4..0000000 --- a/src/main/resources/META-INF/services/com.aizuda.easy.retry.client.core.ExpressionEngine +++ /dev/null @@ -1,2 +0,0 @@ -com.aizuda.easy.retry.client.core.expression.QLExpressEngine -#com.aizuda.easy.retry.client.core.expression.AviatorExpressionEngine \ No newline at end of file diff --git a/src/main/resources/META-INF/services/com.aizuda.easy.retry.client.core.RetryArgSerializer b/src/main/resources/META-INF/services/com.aizuda.easy.retry.client.core.RetryArgSerializer deleted file mode 100644 index 44d9a74..0000000 --- a/src/main/resources/META-INF/services/com.aizuda.easy.retry.client.core.RetryArgSerializer +++ /dev/null @@ -1 +0,0 @@ -#com.aizuda.easy.retry.client.core.serializer.HessianSerializer diff --git a/src/main/resources/META-INF/services/com.aizuda.easy.retry.client.core.RetrySiteSnapshotContext b/src/main/resources/META-INF/services/com.aizuda.easy.retry.client.core.RetrySiteSnapshotContext deleted file mode 100644 index 64d16af..0000000 --- a/src/main/resources/META-INF/services/com.aizuda.easy.retry.client.core.RetrySiteSnapshotContext +++ /dev/null @@ -1 +0,0 @@ -#com.example.easy.retry.spi.TTLRetrySiteSnapshotContext diff --git a/src/main/resources/META-INF/services/com.aizuda.easy.retry.client.core.event.EasyRetryListener b/src/main/resources/META-INF/services/com.aizuda.easy.retry.client.core.event.EasyRetryListener deleted file mode 100644 index 240eada..0000000 --- a/src/main/resources/META-INF/services/com.aizuda.easy.retry.client.core.event.EasyRetryListener +++ /dev/null @@ -1 +0,0 @@ -#com.example.easy.retry.spi.MyEasyRetryListener diff --git a/src/main/resources/META-INF/services/com.aizuda.snail.job.client.core.ExpressionEngine b/src/main/resources/META-INF/services/com.aizuda.snail.job.client.core.ExpressionEngine new file mode 100644 index 0000000..53841cd --- /dev/null +++ b/src/main/resources/META-INF/services/com.aizuda.snail.job.client.core.ExpressionEngine @@ -0,0 +1,2 @@ +#com.aizuda.snailjob.client.core.expression.QLExpressEngine +#com.aizuda.snailjob.client.core.expression.AviatorExpressionEngine \ No newline at end of file diff --git a/src/main/resources/META-INF/services/com.aizuda.snail.job.client.core.RetryArgSerializer b/src/main/resources/META-INF/services/com.aizuda.snail.job.client.core.RetryArgSerializer new file mode 100644 index 0000000..8a6c054 --- /dev/null +++ b/src/main/resources/META-INF/services/com.aizuda.snail.job.client.core.RetryArgSerializer @@ -0,0 +1 @@ +#com.aizuda.snailjob.client.core.serializer.HessianSerializer diff --git a/src/main/resources/META-INF/services/com.aizuda.snail.job.client.core.RetrySiteSnapshotContext b/src/main/resources/META-INF/services/com.aizuda.snail.job.client.core.RetrySiteSnapshotContext new file mode 100644 index 0000000..4512759 --- /dev/null +++ b/src/main/resources/META-INF/services/com.aizuda.snail.job.client.core.RetrySiteSnapshotContext @@ -0,0 +1 @@ +#spi.com.example.snail.job.TTLRetrySiteSnapshotContext diff --git a/src/main/resources/META-INF/services/com.aizuda.snail.job.client.core.event.SnailJobListener b/src/main/resources/META-INF/services/com.aizuda.snail.job.client.core.event.SnailJobListener new file mode 100644 index 0000000..788e1d4 --- /dev/null +++ b/src/main/resources/META-INF/services/com.aizuda.snail.job.client.core.event.SnailJobListener @@ -0,0 +1 @@ +#spi.com.example.snail.job.MySnailJobListener diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 2fe94c8..3a9b573 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,5 +1,6 @@ server: port: 8018 + spring: mvc: pathmatch: @@ -7,8 +8,8 @@ spring: profiles: active: dev datasource: - name: easy_retry - url: jdbc:mysql://localhost:3306/easy_retry_260?useSSL=false&characterEncoding=utf8&useUnicode=true + name: snail_job + url: jdbc:mysql://localhost:3306/snail_job_260?useSSL=false&characterEncoding=utf8&useUnicode=true username: root password: root type: com.zaxxer.hikari.HikariDataSource @@ -22,9 +23,10 @@ spring: pool-name: demo max-lifetime: 1800000 connection-test-query: SELECT 1 + mybatis-plus: mapper-locations: classpath:/mapper/*.xml - typeAliasesPackage: com.example.easy.retry.po + typeAliasesPackage: com.example.snail.job.po global-config: db-config: field-strategy: NOT_EMPTY @@ -43,4 +45,4 @@ snail-job: host: 127.0.0.1 port: 1788 namespace: 764d604ec6fc45f68cd92514c40e9e1a - token: ER_Wyz3dmsdbDOkDujOTSSoBjGQP1BMsVnj + token: SJ_Wyz3dmsdbDOkDujOTSSoBjGQP1BMsVnj diff --git a/src/main/resources/logback-boot.xml b/src/main/resources/logback-boot.xml index f32035a..5ec0889 100644 --- a/src/main/resources/logback-boot.xml +++ b/src/main/resources/logback-boot.xml @@ -1,6 +1,6 @@ - + @@ -79,7 +79,7 @@ - +