gtsoft-snail-job-demo/src/main/java/com/example/easy/retry/controller/LocalAndRemoteRetryController.java

40 lines
1.6 KiB
Java
Raw Normal View History

2023-09-02 17:24:47 +08:00
package com.example.easy.retry.controller;
import com.example.easy.retry.service.impl.LocalRemoteServiceImpl;
2023-09-02 17:24:47 +08:00
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/local-remote")
@Api(value = "模拟先本地再远程重试案例", tags = "先本地再远程重试案例【RetryType.LOCAL_REMOTE】")
public class LocalAndRemoteRetryController {
@Autowired
private LocalRemoteServiceImpl localRemoteServiceImpl;
2023-09-02 17:24:47 +08:00
@GetMapping("/retry")
@ApiOperation(value = "一个简单的入门案例")
public void localRemote() {
localRemoteServiceImpl.localRemote();
2023-09-02 17:24:47 +08:00
}
@GetMapping("/retryWithLocalRemote")
@ApiOperation(
value = "使用同步上报的方式",
notes = "async = false 代表使用同步上传的方式\n"
+ "timeout = 1 代表超时时间为1 \n"
+ "unit = MINUTES 代表超时时间的单位是分钟\n" +
"📢查看任务列表: http://preview.easyretry.com/#/retry-task/list"
)
public void remoteRetryWithLocalRemote(@ApiParam(name = "params", value = "测试参数", defaultValue = "test")
@RequestParam("params") String params) {
localRemoteServiceImpl.remoteRetryWithLocalRemote(params);
2023-09-02 17:24:47 +08:00
}
}