升级3.0.0版本
This commit is contained in:
parent
89f4394b29
commit
4962f1a2c8
@ -1,5 +1,6 @@
|
|||||||
package com.example.easy.retry.controller;
|
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.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.Parameters;
|
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.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
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.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@ -34,10 +37,13 @@ public class LocalRetryController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/localRetryWithAnnoOnInterface")
|
@GetMapping("/localRetryWithAnnoOnInterface")
|
||||||
@ApiOperation(
|
@Operation(
|
||||||
value = "@Retryable在接口上执行重试"
|
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);
|
localRetryService.localRetryWithAnnoOnInterface(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,9 +104,9 @@ public class LocalRetryController {
|
|||||||
/**
|
/**
|
||||||
* 使用自定义的异常处理类 OrderRetryMethod
|
* 使用自定义的异常处理类 OrderRetryMethod
|
||||||
*/
|
*/
|
||||||
@ApiOperation(
|
@Operation(
|
||||||
value = "指定自定义的异常处理类",
|
description = "指定自定义的异常处理类",
|
||||||
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"
|
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){
|
public boolean localRetryWithRetryMethod(@RequestBody OrderVo orderVo){
|
||||||
return localRetryService.localRetryWithRetryMethod(orderVo);
|
return localRetryService.localRetryWithRetryMethod(orderVo);
|
||||||
|
@ -9,6 +9,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
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.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@ -147,7 +148,8 @@ public class RemoteRetryController {
|
|||||||
"📢查看任务列表: http://preview.easyretry.com/#/retry-task/list"
|
"📢查看任务列表: http://preview.easyretry.com/#/retry-task/list"
|
||||||
)
|
)
|
||||||
@PostMapping("/retryWithCallback/{scene}")
|
@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) {
|
@PathVariable("scene") String scene, @RequestBody OrderVo orderVo) {
|
||||||
remoteRetryService.remoteRetryWithCompleteCallback(scene, orderVo);
|
remoteRetryService.remoteRetryWithCompleteCallback(scene, orderVo);
|
||||||
}
|
}
|
||||||
|
@ -6,4 +6,7 @@ package com.example.easy.retry.service;
|
|||||||
*/
|
*/
|
||||||
public interface LocalRemoteService {
|
public interface LocalRemoteService {
|
||||||
|
|
||||||
|
void localRemote();
|
||||||
|
|
||||||
|
String remoteRetryWithLocalRemote(String requestId);
|
||||||
}
|
}
|
||||||
|
@ -6,4 +6,5 @@ package com.example.easy.retry.service;
|
|||||||
*/
|
*/
|
||||||
public interface ManualRetryExecutorMethodService {
|
public interface ManualRetryExecutorMethodService {
|
||||||
|
|
||||||
|
void myExecutorMethod(String params);
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
@Service
|
@Service
|
||||||
public class LocalRemoteServiceImpl implements LocalRemoteService {
|
public class LocalRemoteServiceImpl implements LocalRemoteService {
|
||||||
|
|
||||||
|
@Override
|
||||||
@Retryable(scene = "localRemote", retryStrategy = RetryType.LOCAL_REMOTE)
|
@Retryable(scene = "localRemote", retryStrategy = RetryType.LOCAL_REMOTE)
|
||||||
public void localRemote() {
|
public void localRemote() {
|
||||||
System.out.println("local retry 方法开始执行");
|
System.out.println("local retry 方法开始执行");
|
||||||
@ -27,6 +28,7 @@ public class LocalRemoteServiceImpl implements LocalRemoteService {
|
|||||||
* 使用先本地再远程的策略同步上传重试请求 retryStrategy = LOCAL_REMOTE 代表本地重试3次后再执行远程上报 async = false 代表使用同步上传的方式 timeout = 1 代表超时时间为1
|
* 使用先本地再远程的策略同步上传重试请求 retryStrategy = LOCAL_REMOTE 代表本地重试3次后再执行远程上报 async = false 代表使用同步上传的方式 timeout = 1 代表超时时间为1
|
||||||
* unit = MINUTES 代表超时时间的单位是分钟
|
* unit = MINUTES 代表超时时间的单位是分钟
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@Retryable(scene = "remoteRetryWithSync", retryStrategy = RetryType.LOCAL_REMOTE,
|
@Retryable(scene = "remoteRetryWithSync", retryStrategy = RetryType.LOCAL_REMOTE,
|
||||||
async = false, timeout = 1, unit = TimeUnit.MINUTES)
|
async = false, timeout = 1, unit = TimeUnit.MINUTES)
|
||||||
public String remoteRetryWithLocalRemote(String requestId) {
|
public String remoteRetryWithLocalRemote(String requestId) {
|
||||||
|
Loading…
Reference in New Issue
Block a user