fix:fix gray release examples bug. (#1068)

pull/1071/head
Haotian Zhang 11 months ago committed by GitHub
parent 86ed684cfa
commit f4af69270c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,3 +20,4 @@
- [refactor:refactor Polaris registration.](https://github.com/Tencent/spring-cloud-tencent/pull/1057)
- [feat:added automatic optimization for dynamic config refresh type.](https://github.com/Tencent/spring-cloud-tencent/pull/1058)
- [fix:fix SCG report wrong service bug when using IP routing.](https://github.com/Tencent/spring-cloud-tencent/pull/1065)
- [fix:fix gray release examples bug.](https://github.com/Tencent/spring-cloud-tencent/pull/1068)

@ -21,6 +21,7 @@ package com.tencent.cloud.polaris.router.grayrelease.front;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -39,11 +40,11 @@ public class FrontController {
* @return information of callee
*/
@GetMapping("/rest")
public String rest() {
public String rest(@RequestHeader("uid") int user) {
String env = System.getenv("SCT_METADATA_CONTENT_env");
String appName = environment.getProperty("spring.application.name");
String curName = appName + "[" + env + "]";
String resp = routerService.rest();
String resp = routerService.rest(user);
return curName + " -> " + resp;
}
}

@ -20,6 +20,7 @@ package com.tencent.cloud.polaris.router.grayrelease.front;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
/**
* Router callee feign client.
@ -30,6 +31,6 @@ import org.springframework.web.bind.annotation.GetMapping;
public interface RouterService {
@GetMapping("/router/gray/rest")
String rest();
String rest(@RequestHeader("uid") int user);
}

@ -21,6 +21,7 @@ package com.tencent.cloud.polaris.router.grayrelease.middle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -39,11 +40,11 @@ public class MiddleController {
* @return information of callee
*/
@GetMapping("/rest")
public String rest() {
public String rest(@RequestHeader("uid") int user) {
String env = System.getenv("SCT_METADATA_CONTENT_env");
String appName = environment.getProperty("spring.application.name");
String curName = appName + "[" + env + "]";
String resp = routerService.rest();
String resp = routerService.rest(user);
return curName + " -> " + resp;
}
}

@ -20,6 +20,7 @@ package com.tencent.cloud.polaris.router.grayrelease.middle;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
/**
* Router callee feign client.
@ -30,6 +31,6 @@ import org.springframework.web.bind.annotation.GetMapping;
public interface RouterService {
@GetMapping("/router/gray/rest")
String rest();
String rest(@RequestHeader("uid") int user);
}

Loading…
Cancel
Save