fix: fix wildcard cb 404 issues

pull/1335/head
andrewshan 1 year ago
parent 9e7be2ef3a
commit a4b4b504a5

@ -63,6 +63,8 @@ public class QuickstartCalleeController {
private boolean ifBadGateway = true; private boolean ifBadGateway = true;
private boolean ifDelay = true; private boolean ifDelay = true;
private boolean isInfoSuccess = true;
/** /**
* Get sum of two value. * Get sum of two value.
* @param value1 value 1 * @param value1 value 1
@ -80,9 +82,14 @@ public class QuickstartCalleeController {
* @return information of callee * @return information of callee
*/ */
@GetMapping("/info") @GetMapping("/info")
public String info() { public ResponseEntity<String> info() {
if (isInfoSuccess) {
LOG.info("Quickstart [{}] Service [{}:{}] is called. datasource = [{}].", appName, ip, port, dataSourceProperties); LOG.info("Quickstart [{}] Service [{}:{}] is called. datasource = [{}].", appName, ip, port, dataSourceProperties);
return String.format("Quickstart [%s] Service [%s:%s] is called. datasource = [%s].", appName, ip, port, dataSourceProperties); return new ResponseEntity<>(String.format("Quickstart [%s] Service [%s:%s] is called. datasource = [%s].", appName, ip, port, dataSourceProperties), HttpStatus.OK);
}
else {
return new ResponseEntity<>(String.format("Failed to call quickstart [%s] service [%s:%s]. datasource = [%s].", appName, ip, port, dataSourceProperties), HttpStatus.BAD_GATEWAY);
}
} }
/** /**
@ -166,6 +173,19 @@ public class QuickstartCalleeController {
} }
} }
@GetMapping("/setInfoSuccess")
public String setInfoSuccess(@RequestParam boolean param) {
this.isInfoSuccess = param;
if (param) {
LOG.info("infoSuccess is set to true.");
return "infoSuccess is set to true.";
}
else {
LOG.info("infoSuccess is set to false.");
return "infoSuccess is set to false.";
}
}
@GetMapping("/faultDetect") @GetMapping("/faultDetect")
public ResponseEntity<String> health() throws InterruptedException { public ResponseEntity<String> health() throws InterruptedException {
if (ifBadGateway) { if (ifBadGateway) {

@ -42,6 +42,6 @@ public interface CircuitBreakerQuickstartCalleeService {
* @param uid uid variable * @param uid uid variable
* @return circuit break info * @return circuit break info
*/ */
@GetMapping("/circuitBreak/wildcard/{uid}") @GetMapping("/quickstart/callee/circuitBreak/wildcard/{uid}")
String circuitBreakWildcard(@PathVariable String uid); String circuitBreakWildcard(@PathVariable String uid);
} }

Loading…
Cancel
Save