text:(连接池链接更改)
parent
bd6233a8c4
commit
699ee9521e
|
@ -18,4 +18,12 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.zx</groupId>
|
||||
<artifactId>muyu-remote</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.etl.config;
|
||||
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @ClassDescription:
|
||||
* @JdkVersion: 17
|
||||
* @Author: zhangxu
|
||||
* @Created: 2024/5/15 9:35
|
||||
*/
|
||||
@Component
|
||||
@Import({DataAccessClientRunner.class})
|
||||
public class DataAccessClientConfig {
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.muyu.etl.config;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.etl.RemoteDataAccessService;
|
||||
import com.muyu.etl.domain.DataSource;
|
||||
import com.muyu.etl.domain.MyDataSource;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassDescription:
|
||||
* @JdkVersion: 17
|
||||
* @Author: zhangxu
|
||||
* @Created: 2024/5/15 9:36
|
||||
*/
|
||||
|
||||
@Log4j2
|
||||
public class DataAccessClientRunner implements ApplicationRunner {
|
||||
|
||||
@Autowired
|
||||
private RemoteDataAccessService remoteDataAccessService;
|
||||
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
Result<TableDataInfo<DataSource>> result = remoteDataAccessService.list(new DataSource());
|
||||
List<DataSource> rows = result.getData().getRows();
|
||||
MyDataSource.info(rows);
|
||||
MyDataSource.size(rows.get(0).getDataSourceName()+"_"+rows.get(0).getId());
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
com.muyu.etl.config.DataAccessClientConfig
|
|
@ -1,4 +1,4 @@
|
|||
package com.zx.domain;
|
||||
package com.muyu.etl.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
|
@ -1,4 +1,4 @@
|
|||
package com.zx.domain;
|
||||
package com.muyu.etl.domain;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
|
@ -92,6 +92,10 @@ public class MyDataSource {
|
|||
* @param key 用于从连接池映射中获取特定DruidDataSource的键。
|
||||
*/
|
||||
public static void size(String key){
|
||||
for (String s : pools.keySet()) {
|
||||
log.info(s);
|
||||
}
|
||||
|
||||
// 根据键从连接池映射中获取DruidDataSource实例
|
||||
DruidDataSource druidDataSource = pools.get(key);
|
||||
// 获取当前正在使用的连接数量
|
|
@ -1,4 +1,4 @@
|
|||
package com.zx.domain.model;
|
||||
package com.muyu.etl.domain.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
|
@ -103,6 +103,12 @@
|
|||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.zx.text;
|
||||
package com.muyu.etl.text;
|
||||
|
||||
/**
|
||||
* @ClassDescription:
|
|
@ -1,4 +1,4 @@
|
|||
package com.zx.text;
|
||||
package com.muyu.etl.text;
|
||||
|
||||
/**
|
||||
* @ClassDescription:
|
|
@ -1,4 +1,4 @@
|
|||
package com.zx.text;
|
||||
package com.muyu.etl.text;
|
||||
|
||||
/**
|
||||
* @ClassDescription:
|
|
@ -1,4 +1,4 @@
|
|||
package com.zx.text;
|
||||
package com.muyu.etl.text;
|
||||
|
||||
/**
|
||||
* @ClassDescription:
|
|
@ -1,4 +1,4 @@
|
|||
package com.zx.text;
|
||||
package com.muyu.etl.text;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
|
@ -1,4 +1,4 @@
|
|||
package com.zx.text;
|
||||
package com.muyu.etl.text;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.zx.text;
|
||||
package com.muyu.etl.text;
|
||||
|
||||
/**
|
||||
* @ClassDescription:
|
|
@ -5,9 +5,8 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-modules</artifactId>
|
||||
<artifactId>muyu-etl</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>com.zx</groupId>
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package com.zx;
|
||||
package com.muyu.etl;
|
||||
|
||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.system.remote.factory.RemoteUserFallbackFactory;
|
||||
import com.zx.domain.AssetModel;
|
||||
import com.muyu.etl.domain.AssetModel;
|
||||
import com.muyu.etl.factory.AssetModelFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
@ -13,15 +12,15 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||
* @ClassDescription:
|
||||
* @JdkVersion: 17
|
||||
* @Author: zhangxu
|
||||
* @Created: 2024/5/13 14:08
|
||||
* @Created: 2024/5/15 16:23
|
||||
*/
|
||||
@FeignClient(contextId = "remoteAssetModelService",
|
||||
value = ServiceNameConstants.SYSTEM_SERVICE,
|
||||
fallbackFactory = RemoteUserFallbackFactory.class)
|
||||
value = "muyu-etl",
|
||||
fallbackFactory = AssetModelFallbackFactory.class)
|
||||
public interface RemoteAssetModelService {
|
||||
|
||||
@PostMapping("/model/list")
|
||||
public Result<TableDataInfo<AssetModel>> list(@RequestBody AssetModel assetModel);
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.muyu.etl;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.etl.domain.DataSource;
|
||||
import com.muyu.etl.factory.DataAccessFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
/**
|
||||
* @ClassDescription:
|
||||
* @JdkVersion: 17
|
||||
* @Author: zhangxu
|
||||
* @Created: 2024/5/13 14:08
|
||||
*/
|
||||
@FeignClient(contextId = "remoteDataAccessService",
|
||||
value = "muyu-etl",
|
||||
fallbackFactory = DataAccessFallbackFactory.class)
|
||||
public interface RemoteDataAccessService {
|
||||
|
||||
@GetMapping("/source/list")
|
||||
public Result<TableDataInfo<DataSource>> list(DataSource assetModel);
|
||||
|
||||
|
||||
}
|
|
@ -1,10 +1,11 @@
|
|||
package com.zx.factory;
|
||||
package com.muyu.etl.factory;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.zx.RemoteAssetModelService;
|
||||
import com.zx.domain.AssetModel;
|
||||
import com.muyu.etl.RemoteAssetModelService;
|
||||
import com.muyu.etl.domain.AssetModel;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @ClassDescription:
|
||||
|
@ -12,13 +13,15 @@ import org.springframework.cloud.openfeign.FallbackFactory;
|
|||
* @Author: zhangxu
|
||||
* @Created: 2024/5/13 14:14
|
||||
*/
|
||||
@Component
|
||||
public class AssetModelFallbackFactory implements FallbackFactory<RemoteAssetModelService> {
|
||||
@Override
|
||||
public RemoteAssetModelService create(Throwable cause) {
|
||||
return new RemoteAssetModelService() {
|
||||
@Override
|
||||
public Result<TableDataInfo<AssetModel>> list(AssetModel assetModel) {
|
||||
return Result.error("获取数据模型列表失败");
|
||||
|
||||
return Result.error("获取数据模型失败");
|
||||
}
|
||||
};
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.muyu.etl.factory;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.etl.RemoteDataAccessService;
|
||||
import com.muyu.etl.domain.DataSource;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @ClassDescription:
|
||||
* @JdkVersion: 17
|
||||
* @Author: zhangxu
|
||||
* @Created: 2024/5/15 16:20
|
||||
*/
|
||||
@Component
|
||||
public class DataAccessFallbackFactory implements FallbackFactory<RemoteDataAccessService> {
|
||||
@Override
|
||||
public RemoteDataAccessService create(Throwable cause) {
|
||||
return new RemoteDataAccessService() {
|
||||
@Override
|
||||
public Result<TableDataInfo<DataSource>> list(DataSource dataSource) {
|
||||
return Result.error("获取数据源列表失败");
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
com.muyu.etl.factory.AssetModelFallbackFactory
|
||||
com.muyu.etl.factory.DataAccessFallbackFactory
|
|
@ -15,6 +15,7 @@
|
|||
<module>muyu-etl-common</module>
|
||||
<module>muyu-etl-service</module>
|
||||
<module>muyu-etl-client</module>
|
||||
<module>muyu-remote</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
|
|
@ -55,6 +55,12 @@
|
|||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>rule.engine</groupId>
|
||||
<artifactId>muyu-rule-engine-remote</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package com.muyu.rule.engine.config;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.rule.engine.domain.EngineMaintenance;
|
||||
import com.muyu.rule.engine.domain.resp.EngineMaintenanceResp;
|
||||
import com.muyu.rule.engine.factory.RemoteRuleEngineService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassDescription:
|
||||
* @JdkVersion: 17
|
||||
* @Author: zhangxu
|
||||
* @Created: 2024/5/15 9:44
|
||||
*/
|
||||
@Component
|
||||
@Log4j2
|
||||
public class RuleEngineClientRunner implements ApplicationRunner {
|
||||
@Autowired
|
||||
private RemoteRuleEngineService remoteRuleEngineService;
|
||||
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
Result<TableDataInfo<EngineMaintenanceResp>> list = remoteRuleEngineService.list(new EngineMaintenance());
|
||||
List<EngineMaintenanceResp> rows = list.getData().getRows();
|
||||
log.info(rows);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.muyu.rule.engine.config;
|
||||
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @ClassDescription:
|
||||
* @JdkVersion: 17
|
||||
* @Author: zhangxu
|
||||
* @Created: 2024/5/15 15:11
|
||||
*/
|
||||
@Component
|
||||
@Import({RuleEngineClientRunner.class})
|
||||
public class RuleEngineClineConfig {
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package rule.engine.domain;
|
||||
package com.muyu.rule.engine.domain;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutorService;
|
|
@ -1,4 +1,4 @@
|
|||
package rule.engine.domain;
|
||||
package com.muyu.rule.engine.domain;
|
||||
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package rule.engine.domain;
|
||||
package com.muyu.rule.engine.domain;
|
||||
|
||||
import com.zx.domain.DataSource;
|
||||
import com.muyu.etl.domain.DataSource;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.util.HashMap;
|
|
@ -1,4 +1,4 @@
|
|||
package rule.engine.domain;
|
||||
package com.muyu.rule.engine.domain;
|
||||
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
|
@ -1,7 +1,7 @@
|
|||
package rule.engine.domain.req;
|
||||
package com.muyu.rule.engine.domain.req;
|
||||
|
||||
import com.zx.domain.DataAsset;
|
||||
import com.zx.domain.DataSource;
|
||||
import com.muyu.etl.domain.DataAsset;
|
||||
import com.muyu.etl.domain.DataSource;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
|
@ -18,91 +18,15 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies><!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>rule.engine</groupId>
|
||||
<artifactId>muyu-rule-engine-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-modules-system</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
<!-- PostgreSQL JDBC驱动 -->
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
com.muyu.rule.engine.factory.RemoteRuleEngineFallbackFactory
|
|
@ -19,6 +19,12 @@
|
|||
</properties>
|
||||
|
||||
<dependencies><!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.zx</groupId>
|
||||
<artifactId>muyu-etl-client</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>rule.engine</groupId>
|
||||
<artifactId>muyu-rule-engine-common</artifactId>
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
<module>muyu-file</module>
|
||||
<module>muyu-etl</module>
|
||||
<module>muyu-rule-engine</module>
|
||||
<module>muyu-etl/muyu-remote</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>muyu-modules</artifactId>
|
||||
|
|
Loading…
Reference in New Issue