feat: 初始化
This commit is contained in:
+41
@@ -0,0 +1,41 @@
|
||||
package com.yida.data.job.fallback;
|
||||
|
||||
import com.yida.data.common.core.annotation.Fallback;
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.job.Job;
|
||||
import com.yida.data.job.feign.RemoteJobService;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* RemoteJobService fallback处理类
|
||||
*
|
||||
* @author ZYJ
|
||||
* @date 2022/8/26
|
||||
*/
|
||||
@Slf4j
|
||||
@Fallback
|
||||
public class RemoteJobServiceFallback implements FallbackFactory<RemoteJobService> {
|
||||
|
||||
@Override
|
||||
public RemoteJobService create(Throwable throwable) {
|
||||
log.error("RemoteJobService fallback reason:{}", throwable.getMessage());
|
||||
|
||||
return new RemoteJobService() {
|
||||
@Override
|
||||
public ResultBean saveJob(Job job) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultBean saveJobNoPermission(Job job) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultBean delJobByMethod(String beanName, String methodName, String params) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.yida.data.job.feign;
|
||||
|
||||
import com.yida.data.common.core.common.ResultBean;
|
||||
import com.yida.data.common.core.entity.constant.FebsServerConstant;
|
||||
import com.yida.data.common.core.entity.job.Job;
|
||||
|
||||
import com.yida.data.job.fallback.RemoteJobServiceFallback;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
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.RequestParam;
|
||||
|
||||
@FeignClient(value = FebsServerConstant.FEBS_SERVER_JOB, contextId = "jobServiceClient",
|
||||
fallbackFactory = RemoteJobServiceFallback.class)
|
||||
public interface RemoteJobService {
|
||||
|
||||
@PostMapping
|
||||
ResultBean saveJob(@RequestBody Job job);
|
||||
|
||||
@PostMapping("in/job/saveJobNoPermission")
|
||||
ResultBean saveJobNoPermission(@RequestBody Job job);
|
||||
|
||||
@GetMapping("/delJobByMethod")
|
||||
ResultBean delJobByMethod(@RequestParam("beanName") String beanName,
|
||||
@RequestParam("methodName") String methodName,
|
||||
@RequestParam("params") String params);
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
# Auto Configure
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
com.yida.data.job.fallback.RemoteJobServiceFallback
|
||||
Reference in New Issue
Block a user