From 95f229a3a06de69c7b6383f35b684fea13811d82 Mon Sep 17 00:00:00 2001 From: peacewong Date: Tue, 10 Oct 2023 17:38:16 +0800 Subject: [PATCH] Data source service forwarding optimization --- .../org/apache/linkis/rpc/conf/RPCConfiguration.scala | 8 -------- .../apache/linkis/gateway/parser/GatewayParser.scala | 11 +++++++++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/linkis-commons/linkis-rpc/src/main/scala/org/apache/linkis/rpc/conf/RPCConfiguration.scala b/linkis-commons/linkis-rpc/src/main/scala/org/apache/linkis/rpc/conf/RPCConfiguration.scala index 3a34e42a0e..bbe2d4acd3 100644 --- a/linkis-commons/linkis-rpc/src/main/scala/org/apache/linkis/rpc/conf/RPCConfiguration.scala +++ b/linkis-commons/linkis-rpc/src/main/scala/org/apache/linkis/rpc/conf/RPCConfiguration.scala @@ -65,14 +65,6 @@ object RPCConfiguration { "cs,contextservice,data-source-manager,metadataQuery,metadatamanager,query,jobhistory,application,configuration,filesystem,udf,variable,microservice,errorcode,bml,datasource,basedata-manager" ).getValue.split(",") - val METADATAQUERY_SERVICE_APPLICATION_NAME: CommonVars[String] = - CommonVars("wds.linkis.gateway.conf.publicservice.name", "linkis-ps-metadataquery") - - val METADATAQUERY_SERVICE_LIST: Array[String] = CommonVars( - "wds.linkis.gateway.conf.metadataquery.list", - "metadatamanager,metadataquery" - ).getValue.split(",") - val LINKIS_MANAGER_SERVICE_NAME: CommonVars[String] = CommonVars("wds.linkis.gateway.conf.linkismanager.name", "linkis-cg-linkismanager") diff --git a/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-core/src/main/scala/org/apache/linkis/gateway/parser/GatewayParser.scala b/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-core/src/main/scala/org/apache/linkis/gateway/parser/GatewayParser.scala index dd336809ab..84f94b51ab 100644 --- a/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-core/src/main/scala/org/apache/linkis/gateway/parser/GatewayParser.scala +++ b/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-core/src/main/scala/org/apache/linkis/gateway/parser/GatewayParser.scala @@ -108,6 +108,12 @@ class DefaultGatewayParser(gatewayParsers: Array[GatewayParser]) extends Abstrac gatewayContext.getGatewayRoute.setRequestURI(path) } gatewayParsers.foreach(_.parse(gatewayContext)) + + /** + * Gateway forwarding logic: PublicService Service exists and is effective And then judge + * metadataquery Service, Continue to judge linkismanager Service, Final judgment + * linkispsdatasource Service + */ if (gatewayContext.getGatewayRoute.getServiceInstance == null) path match { case CLIENT_HEARTBEAT_REGEX(version) => if (sendResponseWhenNotMatchVersion(gatewayContext, version)) return @@ -122,10 +128,11 @@ class DefaultGatewayParser(gatewayParsers: Array[GatewayParser]) extends Abstrac ) { RPCConfiguration.PUBLIC_SERVICE_APPLICATION_NAME.getValue // In order to be compatible with metadata module name refactoring,this logic will be removed in subsequent versions - } else if (RPCConfiguration.METADATAQUERY_SERVICE_LIST.contains(serviceId)) { - RPCConfiguration.METADATAQUERY_SERVICE_APPLICATION_NAME.getValue + } else if (RPCConfiguration.LINKIS_DATASOURCE_SERVICE_LIST.contains(serviceId)) { + RPCConfiguration.LINKIS_DATASOURCE_SERVICE_NAME.getValue } else if (RPCConfiguration.LINKIS_MANAGER_SERVICE_LIST.contains(serviceId)) { RPCConfiguration.LINKIS_MANAGER_SERVICE_NAME.getValue + // After the complete merge is completed, it needs to be removed } else { serviceId }