Skip to content

Commit 7e68121

Browse files
GuoYL123liubao68
authored andcommitted
[SCB-1861] toke the revision when pull from kie
1 parent 528d9ef commit 7e68121

File tree

1 file changed

+5
-2
lines changed
  • dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/client

1 file changed

+5
-2
lines changed

dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/client/KieClient.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ public class KieClient {
5757

5858
private static final int LONG_POLLING_WAIT_TIME_IN_SECONDS = 30;
5959

60+
private static String revision = "0";
61+
6062
private static final KieConfig KIE_CONFIG = KieConfig.INSTANCE;
6163

6264
private final int refreshInterval = KIE_CONFIG.getRefreshInterval();
@@ -115,8 +117,8 @@ void refreshConfig(CountDownLatch latch) {
115117
String path = "/v1/"
116118
+ KieConfig.INSTANCE.getDomainName()
117119
+ "/kie/kv?label=app:"
118-
+ KieConfig.INSTANCE.getAppName();
119-
120+
+ KieConfig.INSTANCE.getAppName()
121+
+ "&revision=" + revision;
120122
long timeout;
121123
if (enableLongPolling && !IS_FIRST_PULL.get()) {
122124
path += "&wait=" + LONG_POLLING_WAIT_TIME_IN_SECONDS + "s";
@@ -131,6 +133,7 @@ void refreshConfig(CountDownLatch latch) {
131133
HttpClientRequest request = client
132134
.get(ipPort.getPort(), ipPort.getHostOrIp(), finalPath, rsp -> {
133135
if (rsp.statusCode() == HttpStatus.SC_OK) {
136+
revision = rsp.getHeader("X-Kie-Revision");
134137
rsp.bodyHandler(buf -> {
135138
try {
136139
Map<String, Object> resMap = KieUtil.getConfigByLabel(JsonUtils.OBJ_MAPPER

0 commit comments

Comments
 (0)