feat: add delay test interface in quickstart.

pull/1665/head
fishtailfu 2 months ago
parent 70218c3a22
commit 51dfcbe16a

@ -159,4 +159,12 @@ public class QuickstartCalleeController {
public String faultToleranceForking() {
return faultToleranceService.forking();
}
@GetMapping("/delayTest")
public String delayTest() throws InterruptedException {
long delay = Long.parseLong(System.getProperty("DELAY_TEST_TIME", "50"));
Thread.sleep(delay);
LOG.info("Quickstart [{}] Service [{}:{}] is called. datasource = [{}]. Delay Time is {}", appName, ip, port, dataSourceProperties, delay);
return String.format("Quickstart [%s] Service [%s:%s] is called. datasource = [%s]. Delay Time is %s", appName, ip, port, dataSourceProperties, delay);
}
}

@ -191,4 +191,11 @@ public class QuickstartCalleeController {
LOG.info("Quickstart Callee Service [{}:{}] is detected right.", ip, port);
return new ResponseEntity<>(String.format("Quickstart Callee Service [%s:%s] is detected right.", ip, port), HttpStatus.OK);
}
@GetMapping("/delayTest")
public String delayTest() throws InterruptedException {
long delay = Long.parseLong(System.getProperty("DELAY_TEST_TIME", "50"));
Thread.sleep(delay);
LOG.info("Quickstart [{}] Service [{}:{}] is called. datasource = [{}]. Delay Time is {}", appName, ip, port, dataSourceProperties, delay);
return String.format("Quickstart [%s] Service [%s:%s] is called. datasource = [%s]. Delay Time is %s", appName, ip, port, dataSourceProperties, delay);
}
}

@ -264,4 +264,10 @@ public class QuickstartCallerController {
public String user(@RequestBody User user) {
return restTemplate.postForObject("http://QuickstartCalleeService/quickstart/callee/user", user, String.class);
}
@GetMapping("/delayTest")
public String delayTest() {
String path = "http://QuickstartCalleeService/quickstart/callee/delayTest";
return restTemplate.getForObject(path, String.class);
}
}

Loading…
Cancel
Save