新增数据接入模块远程调用与熔断,修改任务控制层请求路径
parent
42a47e197e
commit
a4028b4b36
|
@ -22,5 +22,10 @@
|
|||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-common-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-quest-remote</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-quest-common</artifactId>
|
||||
<artifactId>muyu-source-server</artifactId>
|
||||
<version>3.6.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -1,18 +1,26 @@
|
|||
//package com.muyu.source.remote;
|
||||
//
|
||||
//import com.muyu.source.remote.factory.RemoteDataSourceFactory;
|
||||
//import org.springframework.cloud.openfeign.FeignClient;
|
||||
//import com.muyu.common.core.constant.ServiceNameConstants;
|
||||
//
|
||||
///**
|
||||
// * @ Tool:IntelliJ IDEA
|
||||
// * @ Author:CHX
|
||||
// * @ Date:2024-08-21-10:50
|
||||
// * @ Version:1.0
|
||||
// * @ Description:数据源远程调用
|
||||
// * @author Lenovo
|
||||
// */
|
||||
//@FeignClient(contextId = "RemoteDataSourceService",value = ServiceNameConstants.SOURCE_SERVICE,fallbackFactory = RemoteDataSourceFactory.class, path = "/dataSource")
|
||||
//public interface RemoteDataSourceService {
|
||||
//
|
||||
//}
|
||||
package com.muyu.quest.remote;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.quest.remote.factory.RemoteDataSourceFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-08-21-10:50
|
||||
* @ Version:1.0
|
||||
* @ Description:数据源远程调用
|
||||
* @author Lenovo
|
||||
*/
|
||||
@FeignClient(contextId = "RemoteDataSourceService",
|
||||
value = ServiceNameConstants.SOURCE_SERVICE,
|
||||
fallbackFactory = RemoteDataSourceFactory.class,
|
||||
path = "/source")
|
||||
public interface RemoteDataSourceService {
|
||||
|
||||
@PostMapping("/value/findTableValue")
|
||||
public Result findTableValue(@RequestParam("basicId") Long basicId, @RequestParam("sql") String sql);
|
||||
}
|
||||
|
|
|
@ -1,19 +1,25 @@
|
|||
//package com.muyu.source.remote.factory;
|
||||
//
|
||||
//import com.muyu.source.remote.RemoteDataSourceService;
|
||||
//import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
//
|
||||
///**
|
||||
// * @ Tool:IntelliJ IDEA
|
||||
// * @ Author:CHX
|
||||
// * @ Date:2024-08-21-10:54
|
||||
// * @ Version:1.0
|
||||
// * @ Description:
|
||||
// * @author Lenovo
|
||||
// */
|
||||
//public class RemoteDataSourceFactory implements FallbackFactory<RemoteDataSourceService> {
|
||||
// @Override
|
||||
// public RemoteDataSourceService create(Throwable cause) {
|
||||
// return null;
|
||||
// }
|
||||
//}
|
||||
package com.muyu.quest.remote.factory;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.quest.remote.RemoteDataSourceService;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
|
||||
/**
|
||||
* @ Tool:IntelliJ IDEA
|
||||
* @ Author:CHX
|
||||
* @ Date:2024-08-21-10:54
|
||||
* @ Version:1.0
|
||||
* @ Description:
|
||||
* @author Lenovo
|
||||
*/
|
||||
public class RemoteDataSourceFactory implements FallbackFactory<RemoteDataSourceService> {
|
||||
@Override
|
||||
public RemoteDataSourceService create(Throwable cause) {
|
||||
return new RemoteDataSourceService() {
|
||||
@Override
|
||||
public Result findTableValue(Long basicId, String sql) {
|
||||
return Result.error("数据接入模块连接失败,网络异常...");
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import com.muyu.common.core.web.page.TableDataInfo;
|
|||
* @date 2024-08-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/quest")
|
||||
@RequestMapping("/task")
|
||||
public class TaskController extends BaseController
|
||||
{
|
||||
@Resource
|
||||
|
|
Loading…
Reference in New Issue