From 486f3166b6bb833422bcb7472d9f16d503e2bc2d Mon Sep 17 00:00:00 2001
From: byteblogs168 <598092184@qq.com>
Date: Sat, 16 Sep 2023 12:36:17 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A73.0.0=E7=89=88=E6=9C=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../retry/controller/LocalRetryController.java | 18 ++++++++++++------
.../controller/RemoteRetryController.java | 4 +++-
.../easy/retry/service/LocalRemoteService.java | 3 +++
.../ManualRetryExecutorMethodService.java | 1 +
.../service/impl/LocalRemoteServiceImpl.java | 2 ++
5 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/src/main/java/com/example/easy/retry/controller/LocalRetryController.java b/src/main/java/com/example/easy/retry/controller/LocalRetryController.java
index 5613ce2..4f383b1 100644
--- a/src/main/java/com/example/easy/retry/controller/LocalRetryController.java
+++ b/src/main/java/com/example/easy/retry/controller/LocalRetryController.java
@@ -1,5 +1,6 @@
package com.example.easy.retry.controller;
+import com.example.easy.retry.vo.OrderVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
@@ -9,6 +10,8 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@@ -34,10 +37,13 @@ public class LocalRetryController {
}
@GetMapping("/localRetryWithAnnoOnInterface")
- @ApiOperation(
- value = "@Retryable在接口上执行重试"
+ @Operation(
+ summary = "@Retryable在接口上执行重试"
)
- public void localRetryWithAnnoOnInterface(@ApiParam(name = "params", value = "测试参数", defaultValue = "test") @RequestParam("params") String params){
+ public void localRetryWithAnnoOnInterface(
+ @Parameter(name = "params", description = "测试参数", in = ParameterIn.QUERY,
+ schema = @Schema(type = "string", description = "测试参数"))
+ @RequestParam("params") String params) {
localRetryService.localRetryWithAnnoOnInterface(params);
}
@@ -98,9 +104,9 @@ public class LocalRetryController {
/**
* 使用自定义的异常处理类 OrderRetryMethod
*/
- @ApiOperation(
- value = "指定自定义的异常处理类",
- notes ="🥇什么是自定义的异常处理类: https://www.easyretry.com/pages/540554/#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%96%B9%E6%B3%95%E6%89%A7%E8%A1%8C%E5%99%A8"
+ @Operation(
+ description = "指定自定义的异常处理类",
+ summary ="🥇什么是自定义的异常处理类: https://www.easyretry.com/pages/540554/#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%96%B9%E6%B3%95%E6%89%A7%E8%A1%8C%E5%99%A8"
)
public boolean localRetryWithRetryMethod(@RequestBody OrderVo orderVo){
return localRetryService.localRetryWithRetryMethod(orderVo);
diff --git a/src/main/java/com/example/easy/retry/controller/RemoteRetryController.java b/src/main/java/com/example/easy/retry/controller/RemoteRetryController.java
index 2df9ae4..3135c78 100644
--- a/src/main/java/com/example/easy/retry/controller/RemoteRetryController.java
+++ b/src/main/java/com/example/easy/retry/controller/RemoteRetryController.java
@@ -9,6 +9,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -147,7 +148,8 @@ public class RemoteRetryController {
"📢查看任务列表: http://preview.easyretry.com/#/retry-task/list"
)
@PostMapping("/retryWithCallback/{scene}")
- public void remoteRetryWithCallback(@ApiParam(name = "scene", value = "场景 FINISH/MAX_COUNT", defaultValue = "FINISH")
+ public void remoteRetryWithCallback(@Parameter(name = "scene", description = "场景 FINISH/MAX_COUNT",
+ schema = @Schema(type = "string", description = "测试参数", defaultValue = "FINISH"))
@PathVariable("scene") String scene, @RequestBody OrderVo orderVo) {
remoteRetryService.remoteRetryWithCompleteCallback(scene, orderVo);
}
diff --git a/src/main/java/com/example/easy/retry/service/LocalRemoteService.java b/src/main/java/com/example/easy/retry/service/LocalRemoteService.java
index 833d52b..6624a41 100644
--- a/src/main/java/com/example/easy/retry/service/LocalRemoteService.java
+++ b/src/main/java/com/example/easy/retry/service/LocalRemoteService.java
@@ -6,4 +6,7 @@ package com.example.easy.retry.service;
*/
public interface LocalRemoteService {
+ void localRemote();
+
+ String remoteRetryWithLocalRemote(String requestId);
}
diff --git a/src/main/java/com/example/easy/retry/service/ManualRetryExecutorMethodService.java b/src/main/java/com/example/easy/retry/service/ManualRetryExecutorMethodService.java
index ae61ee3..9f2e589 100644
--- a/src/main/java/com/example/easy/retry/service/ManualRetryExecutorMethodService.java
+++ b/src/main/java/com/example/easy/retry/service/ManualRetryExecutorMethodService.java
@@ -6,4 +6,5 @@ package com.example.easy.retry.service;
*/
public interface ManualRetryExecutorMethodService {
+ void myExecutorMethod(String params);
}
diff --git a/src/main/java/com/example/easy/retry/service/impl/LocalRemoteServiceImpl.java b/src/main/java/com/example/easy/retry/service/impl/LocalRemoteServiceImpl.java
index c5b9dd4..d469c22 100644
--- a/src/main/java/com/example/easy/retry/service/impl/LocalRemoteServiceImpl.java
+++ b/src/main/java/com/example/easy/retry/service/impl/LocalRemoteServiceImpl.java
@@ -17,6 +17,7 @@ import java.util.concurrent.TimeUnit;
@Service
public class LocalRemoteServiceImpl implements LocalRemoteService {
+ @Override
@Retryable(scene = "localRemote", retryStrategy = RetryType.LOCAL_REMOTE)
public void localRemote() {
System.out.println("local retry 方法开始执行");
@@ -27,6 +28,7 @@ public class LocalRemoteServiceImpl implements LocalRemoteService {
* 使用先本地再远程的策略同步上传重试请求 retryStrategy = LOCAL_REMOTE 代表本地重试3次后再执行远程上报 async = false 代表使用同步上传的方式 timeout = 1 代表超时时间为1
* unit = MINUTES 代表超时时间的单位是分钟
*/
+ @Override
@Retryable(scene = "remoteRetryWithSync", retryStrategy = RetryType.LOCAL_REMOTE,
async = false, timeout = 1, unit = TimeUnit.MINUTES)
public String remoteRetryWithLocalRemote(String requestId) {