feat()规则引擎初始化(RabbitMq)

master_fei
Yunfei Du 2024-05-19 18:05:10 +08:00
parent 61e745a009
commit cb6f077d33
8 changed files with 70 additions and 27 deletions

View File

@ -0,0 +1,7 @@
package com.etl;
public class Main {
public static void main(String[] args) {
System.out.println ( "Hello world!" );
}
}

View File

@ -1,9 +1,4 @@
package com.etl.data.client.config;
import com.alibaba.druid.pool.DruidPooledConnection;
import com.etl.data.client.connPool.service.ConnPoolManagementService;
import com.etl.data.domain.DataSource;
import com.etl.data.domain.req.DataSourceQueryReq;
import com.etl.data.source.remote.RemoteDataSourceService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
@ -28,27 +23,26 @@ public class DataAccessClientRunner implements ApplicationRunner {
@Override
public void run(ApplicationArguments args) {
List< DataSource > dataSourceList = remoteDataSourceService.getDataSourceList ( new DataSourceQueryReq ( ) ).getData ( ).getRows ( );
if (!dataSourceList.isEmpty ()){
ConnPoolManagementService.init ( dataSourceList );
try {
DruidPooledConnection druidPooledConnection = ConnPoolManagementService.get ( dataSourceList.get ( 0 ).getKey ( ) );
// Map< DruidPooledConnection, String > connToKey = ConnPoolManagementService.getConnToKey ( );
log.info ( "connToKey:{}", druidPooledConnection );
// JDBCConcreteClass jdbcConcreteClass = new JDBCConcreteClass ( );
// PreparedStatement preparedStatement = jdbcConcreteClass.getPreparedStatement ( connection, "select * from car" );
// ResultSetMetaData rsd = preparedStatement.getMetaData ( );
// for (int i = 1; i <= rsd.getColumnCount ( ); i++) {
// log.info ( "类型:{}", rsd.getColumnClassName ( i ) );
// }
ConnPoolManagementService.returnConnection ( druidPooledConnection );
} catch (Exception e) {
log.error ( "数据访问客户端运行程序异常:{}", e.getMessage ( ) );
throw new RuntimeException ( e );
}
}
// List< DataSource > dataSourceList = remoteDataSourceService.getDataSourceList ( new DataSourceQueryReq ( ) ).getData ( ).getRows ( );
// if (!dataSourceList.isEmpty ()){
// ConnPoolManagementService.init ( dataSourceList );
// try {
// DruidPooledConnection druidPooledConnection = ConnPoolManagementService.get ( dataSourceList.get ( 0 ).getKey ( ) );
//// Map< DruidPooledConnection, String > connToKey = ConnPoolManagementService.getConnToKey ( );
//// log.info ( "connToKey:{}", druidPooledConnection );
//
//// JDBCConcreteClass jdbcConcreteClass = new JDBCConcreteClass ( );
//// PreparedStatement preparedStatement = jdbcConcreteClass.getPreparedStatement ( connection, "select * from car" );
//// ResultSetMetaData rsd = preparedStatement.getMetaData ( );
//// for (int i = 1; i <= rsd.getColumnCount ( ); i++) {
//// log.info ( "类型:{}", rsd.getColumnClassName ( i ) );
//// }
//
// ConnPoolManagementService.returnConnection ( druidPooledConnection );
// } catch (Exception e) {
// log.error ( "数据访问客户端运行程序异常:{}", e.getMessage ( ) );
// throw new RuntimeException ( e );
// }
// }
}
}

View File

@ -18,6 +18,17 @@
</properties>
<dependencies>
<!-- Spring Cloud Sleuth -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<!-- Spring Cloud zipkin -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
<version>2.2.8.RELEASE</version>
</dependency>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>

View File

@ -6,6 +6,7 @@ import com.etl.common.swagger.annotation.EnableCustomSwagger2;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
*
@ -16,6 +17,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@EnableCustomSwagger2
@EnableMyFeignClients
@SpringBootApplication
@EnableTransactionManagement
@MapperScan("com.etl.data.mapper")
public class ETLDataSourceApplication {
public static void main (String[] args) {

View File

@ -4,6 +4,18 @@ server:
# Spring
spring:
zipkin:
base-url: http://111.229.102.61:9411
sender:
type: web
rabbitmq:
host: 43.142.44.217
username: guest
password: guest
virtualhost: /
port: 5672
publisher-confirm-type: correlated
publisher-returns: true
main:
allow-circular-references: true
application:

View File

@ -18,6 +18,17 @@
</properties>
<dependencies>
<!-- Spring Cloud Sleuth -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<!-- Spring Cloud zipkin -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
<version>2.2.8.RELEASE</version>
</dependency>
<dependency>
<groupId>com.etl</groupId>
<artifactId>etl-data-source-client</artifactId>

View File

@ -7,6 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* @ClassName DataUnitApplication
@ -18,6 +19,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableCustomSwagger2
@EnableMyFeignClients
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
@EnableTransactionManagement
@EnableAsync
public class DataUnitApplication {
public static void main(String[] args) {

View File

@ -4,6 +4,10 @@ server:
# Spring
spring:
zipkin:
base-url: http://111.229.102.61:9411
sender:
type: web
main:
allow-circular-references: true
application: