Skip to content

Commit 2135a85

Browse files
feat:add response type for TSF Consul. (#666)
Signed-off-by: Haotian Zhang <[email protected]>
1 parent bcaa0ab commit 2135a85

File tree

12 files changed

+12
-1
lines changed

12 files changed

+12
-1
lines changed

polaris-plugins/polaris-plugins-connector/connector-consul/src/main/java/com/tencent/polaris/plugins/connector/consul/service/InstanceService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ public void sendRequest(ServiceUpdateTask serviceUpdateTask) {
189189
newDiscoverResponseBuilder.setService(service);
190190
newDiscoverResponseBuilder.addAllInstances(instanceList);
191191
newDiscoverResponseBuilder.setCode(UInt32Value.of(code));
192+
newDiscoverResponseBuilder.setType(ResponseProto.DiscoverResponse.DiscoverResponseType.INSTANCE);
192193

193194
ServerEvent serverEvent = new ServerEvent(serviceUpdateTask.getServiceEventKey(), newDiscoverResponseBuilder.build(), null, SERVER_CONNECTOR_CONSUL);
194195
boolean svcDeleted = serviceUpdateTask.notifyServerEvent(serverEvent);

polaris-plugins/polaris-plugins-connector/connector-consul/src/main/java/com/tencent/polaris/plugins/connector/consul/service/ServiceService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ public void sendRequest(ServiceUpdateTask serviceUpdateTask) {
100100
newDiscoverResponseBuilder.setService(newService);
101101
newDiscoverResponseBuilder.addAllServices(serviceList);
102102
newDiscoverResponseBuilder.setCode(UInt32Value.of(code));
103+
newDiscoverResponseBuilder.setType(ResponseProto.DiscoverResponse.DiscoverResponseType.SERVICES);
103104

104105
ServerEvent serverEvent = new ServerEvent(serviceUpdateTask.getServiceEventKey(), newDiscoverResponseBuilder.build(), null, SERVER_CONNECTOR_CONSUL);
105106
boolean svcDeleted = serviceUpdateTask.notifyServerEvent(serverEvent);

polaris-plugins/polaris-plugins-connector/connector-consul/src/main/java/com/tencent/polaris/plugins/connector/consul/service/authority/AuthorityService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ public void sendRequest(ServiceUpdateTask serviceUpdateTask) {
132132
newDiscoverResponseBuilder.addAllBlockAllowListRule(ruleList);
133133
}
134134
newDiscoverResponseBuilder.setCode(UInt32Value.of(code));
135+
newDiscoverResponseBuilder.setType(ResponseProto.DiscoverResponse.DiscoverResponseType.BLOCK_ALLOW_RULE);
135136
ServerEvent serverEvent = new ServerEvent(serviceUpdateTask.getServiceEventKey(), newDiscoverResponseBuilder.build(), null, SERVER_CONNECTOR_CONSUL);
136137
boolean svcDeleted = serviceUpdateTask.notifyServerEvent(serverEvent);
137138
if (newIndex != null) {

polaris-plugins/polaris-plugins-connector/connector-consul/src/main/java/com/tencent/polaris/plugins/connector/consul/service/circuitbreaker/CircuitBreakingService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ public void sendRequest(ServiceUpdateTask serviceUpdateTask) {
152152
}
153153
newDiscoverResponseBuilder.setCircuitBreaker(newCircuitBreakerBuilder);
154154
newDiscoverResponseBuilder.setCode(UInt32Value.of(code));
155+
newDiscoverResponseBuilder.setType(ResponseProto.DiscoverResponse.DiscoverResponseType.CIRCUIT_BREAKER);
155156
ServerEvent serverEvent = new ServerEvent(serviceUpdateTask.getServiceEventKey(), newDiscoverResponseBuilder.build(), null, SERVER_CONNECTOR_CONSUL);
156157
boolean svcDeleted = serviceUpdateTask.notifyServerEvent(serverEvent);
157158
if (newIndex != null) {

polaris-plugins/polaris-plugins-connector/connector-consul/src/main/java/com/tencent/polaris/plugins/connector/consul/service/fault/FaultService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ public void sendRequest(ServiceUpdateTask serviceUpdateTask) {
139139
newDiscoverResponseBuilder.addAllFaultInjection(faultInjectionList);
140140
}
141141
newDiscoverResponseBuilder.setCode(UInt32Value.of(code));
142+
newDiscoverResponseBuilder.setType(ResponseProto.DiscoverResponse.DiscoverResponseType.FAULT_INJECTION);
142143
ServerEvent serverEvent = new ServerEvent(serviceUpdateTask.getServiceEventKey(), newDiscoverResponseBuilder.build(), null, SERVER_CONNECTOR_CONSUL);
143144
boolean svcDeleted = serviceUpdateTask.notifyServerEvent(serverEvent);
144145
if (newIndex != null) {

polaris-plugins/polaris-plugins-connector/connector-consul/src/main/java/com/tencent/polaris/plugins/connector/consul/service/lane/LaneService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ protected void sendRequest(ServiceUpdateTask serviceUpdateTask) {
168168
}
169169
newDiscoverResponseBuilder.setCode(UInt32Value.of(code));
170170
newDiscoverResponseBuilder.setService(newServiceBuilder);
171+
newDiscoverResponseBuilder.setType(ResponseProto.DiscoverResponse.DiscoverResponseType.LANE);
171172
ServerEvent serverEvent = new ServerEvent(serviceUpdateTask.getServiceEventKey(), newDiscoverResponseBuilder.build(), null, SERVER_CONNECTOR_CONSUL);
172173
boolean svcDeleted = serviceUpdateTask.notifyServerEvent(serverEvent);
173174
// 重写index

polaris-plugins/polaris-plugins-connector/connector-consul/src/main/java/com/tencent/polaris/plugins/connector/consul/service/lossless/LosslessService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ public void sendRequest(ServiceUpdateTask serviceUpdateTask) {
148148

149149
newDiscoverResponseBuilder.addAllLosslessRules(losslessRuleList);
150150
newDiscoverResponseBuilder.setCode(UInt32Value.of(code));
151+
newDiscoverResponseBuilder.setType(ResponseProto.DiscoverResponse.DiscoverResponseType.LOSSLESS);
151152
ServerEvent serverEvent = new ServerEvent(serviceUpdateTask.getServiceEventKey(), newDiscoverResponseBuilder.build(), null, SERVER_CONNECTOR_CONSUL);
152153
boolean svcDeleted = serviceUpdateTask.notifyServerEvent(serverEvent);
153154
if (newIndex != null) {

polaris-plugins/polaris-plugins-connector/connector-consul/src/main/java/com/tencent/polaris/plugins/connector/consul/service/mirroring/MirroringService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ public void sendRequest(ServiceUpdateTask serviceUpdateTask) {
142142
newDiscoverResponseBuilder.addAllTrafficMirroring(trafficMirroringList);
143143
}
144144
newDiscoverResponseBuilder.setCode(UInt32Value.of(code));
145+
newDiscoverResponseBuilder.setType(ResponseProto.DiscoverResponse.DiscoverResponseType.TRAFFIC_MIRRORING);
145146
ServerEvent serverEvent = new ServerEvent(serviceUpdateTask.getServiceEventKey(), newDiscoverResponseBuilder.build(), null, SERVER_CONNECTOR_CONSUL);
146147
boolean svcDeleted = serviceUpdateTask.notifyServerEvent(serverEvent);
147148
if (newIndex != null) {

polaris-plugins/polaris-plugins-connector/connector-consul/src/main/java/com/tencent/polaris/plugins/connector/consul/service/ratelimiting/RateLimitingService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ public void sendRequest(ServiceUpdateTask serviceUpdateTask) {
139139
}
140140
newDiscoverResponseBuilder.setRateLimit(newRateLimitBuilder);
141141
newDiscoverResponseBuilder.setCode(UInt32Value.of(code));
142+
newDiscoverResponseBuilder.setType(ResponseProto.DiscoverResponse.DiscoverResponseType.RATE_LIMIT);
142143
ServerEvent serverEvent = new ServerEvent(serviceUpdateTask.getServiceEventKey(), newDiscoverResponseBuilder.build(), null, SERVER_CONNECTOR_CONSUL);
143144
boolean svcDeleted = serviceUpdateTask.notifyServerEvent(serverEvent);
144145
if (newIndex != null) {

polaris-plugins/polaris-plugins-connector/connector-consul/src/main/java/com/tencent/polaris/plugins/connector/consul/service/router/NearByRouteRuleService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ public void sendRequest(ServiceUpdateTask serviceUpdateTask) {
135135
newDiscoverResponseBuilder.addAllNearbyRouteRules(routes);
136136
}
137137
newDiscoverResponseBuilder.setCode(UInt32Value.of(code));
138+
newDiscoverResponseBuilder.setType(ResponseProto.DiscoverResponse.DiscoverResponseType.NEARBY_ROUTE_RULE);
138139
ServerEvent serverEvent = new ServerEvent(serviceUpdateTask.getServiceEventKey(), newDiscoverResponseBuilder.build(), null, SERVER_CONNECTOR_CONSUL);
139140
boolean svcDeleted = serviceUpdateTask.notifyServerEvent(serverEvent);
140141
// 重写index

0 commit comments

Comments
 (0)