Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions polaris-assembly/polaris-assembly-factory/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@
<artifactId>router-isolated</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.tencent.polaris</groupId>
<artifactId>router-lane</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.tencent.polaris</groupId>
<artifactId>router-healthy</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions polaris-circuitbreaker/polaris-circuitbreaker-factory/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
<artifactId>router-isolated</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.tencent.polaris</groupId>
<artifactId>router-lane</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.tencent.polaris</groupId>
<artifactId>router-healthy</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ consumer:
beforeChain:
# 隔离路由
- isolatedRouter
# 泳道路由
- laneRouter
#描述: 服务路由链
chain:
# 命名空间就近路由
- namespaceRouter
# 泳道路由
- laneRouter
# 元数据路由
- metadataRouter
# 规则路由
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static int compareSingleValue(String value1, String value2) {
return 0;
}
if (serviceWildcard1) {
// 1 before 2
// 2 before 1
return 1;
}
if (serviceWildcard2) {
Expand All @@ -52,4 +52,14 @@ public static int compareService(String namespace1, String service1, String name
}
return CompareUtils.compareSingleValue(service1, service2);
}

/**
* compare two boolean.
*/
public static int compareBoolean(boolean b1, boolean b2) {
if (b1 == b2) {
return 0;
}
return b1 ? -1 : 1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ public static boolean matchMetadata(Map<String, MatchString> ruleMeta, Map<Strin
return matchMetadata(ruleMeta, destMeta, null, isMatchSource, multiEnvRouterParamMap, variables, null);
}

// 匹配metadata
public static boolean matchMetadata(Map<String, MatchString> ruleMeta, Map<String, String> destMeta, MetadataContainerGroup metadataContainerGroup) {
return matchMetadata(ruleMeta, destMeta, metadataContainerGroup, true, Collections.emptyMap(), Collections.emptyMap(), null);
}

// 匹配metadata
public static boolean matchMetadata(Map<String, MatchString> ruleMeta, Map<String, String> destMeta,
MetadataContainerGroup metadataContainerGroup, boolean isMatchSource,
Expand Down Expand Up @@ -223,7 +228,7 @@ public static boolean matchMetadata(Map<String, MatchString> ruleMeta, Map<Strin
destMetaValue = metadataContainerGroup.getCustomMetadataContainer().getRawMetadataStringValue(ruleMetaKey);
}
}
if (StringUtils.isBlank(destMetaValue) && destMeta.containsKey(ruleMetaKey)) {
if (StringUtils.isBlank(destMetaValue) && CollectionUtils.isNotEmpty(destMeta) && destMeta.containsKey(ruleMetaKey)) {
destMetaValue = destMeta.get(ruleMetaKey);
}
if (StringUtils.isNotBlank(destMetaValue)) {
Expand Down
5 changes: 5 additions & 0 deletions polaris-configuration/polaris-configuration-factory/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@
<artifactId>router-isolated</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.tencent.polaris</groupId>
<artifactId>router-lane</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.tencent.polaris</groupId>
<artifactId>router-healthy</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ public void execute() {
|| serviceEventKey.getEventType().equals(EventType.NEARBY_ROUTE_RULE)
|| serviceEventKey.getEventType().equals(EventType.LOSSLESS)
|| serviceEventKey.getEventType().equals(EventType.CIRCUIT_BREAKING)
|| serviceEventKey.getEventType().equals(EventType.RATE_LIMITING)))) {
|| serviceEventKey.getEventType().equals(EventType.RATE_LIMITING)
|| serviceEventKey.getEventType().equals(EventType.LANE_RULE)))) {
return;
}
boolean svcDeleted = this.notifyServerEvent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import com.tencent.polaris.plugins.connector.consul.service.ServiceService;
import com.tencent.polaris.plugins.connector.consul.service.circuitbreaker.CircuitBreakingService;
import com.tencent.polaris.plugins.connector.consul.service.lossless.LosslessService;
import com.tencent.polaris.plugins.connector.consul.service.lane.LaneService;
import com.tencent.polaris.plugins.connector.consul.service.ratelimiting.RateLimitingService;
import com.tencent.polaris.plugins.connector.consul.service.router.NearByRouteRuleService;
import com.tencent.polaris.plugins.connector.consul.service.router.RoutingService;
Expand Down Expand Up @@ -234,6 +235,7 @@ private void initActually(InitContext ctx, ServerConnectorConfig connectorConfig
consulServiceMap.put(ServiceEventKey.EventType.LOSSLESS, new LosslessService(consulClient, consulRawClient, consulContext, "consul-lossless", mapper));
consulServiceMap.put(ServiceEventKey.EventType.CIRCUIT_BREAKING, new CircuitBreakingService(consulClient, consulRawClient, consulContext, "consul-circuit-breaking", mapper));
consulServiceMap.put(ServiceEventKey.EventType.RATE_LIMITING, new RateLimitingService(consulClient, consulRawClient, consulContext, "consul-rate-limiting", mapper));
consulServiceMap.put(ServiceEventKey.EventType.LANE_RULE, new LaneService(consulClient, consulRawClient, consulContext, "consul-lane", mapper));
initialized = true;
}

Expand Down
Loading
Loading