升级3.0.0版本

This commit is contained in:
byteblogs168 2023-09-16 12:36:17 +08:00
parent c573769048
commit 486f3166b6
5 changed files with 21 additions and 7 deletions

View File

@ -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);

View File

@ -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);
}

View File

@ -6,4 +6,7 @@ package com.example.easy.retry.service;
*/
public interface LocalRemoteService {
void localRemote();
String remoteRetryWithLocalRemote(String requestId);
}

View File

@ -6,4 +6,5 @@ package com.example.easy.retry.service;
*/
public interface ManualRetryExecutorMethodService {
void myExecutorMethod(String params);
}

View File

@ -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) {