- private Service removeService(String name) throws ServiceException {
- synchronized (this.services) {
- Service service = this.services.getService(name);
- this.services.remove(service.name());
- return service;
+ @ApiOperation(value = "Heartbeat from a serice")
+ @ApiResponses(
+ value = { //
+ @ApiResponse(code = 200, message = "Service supervision timer refreshed, OK"),
+ @ApiResponse(code = 404, message = "The service is not found, needs re-registration")})
+ @PostMapping("/services/keepalive")
+ public ResponseEntity<String> keepAliveService(//
+ @RequestParam(name = "name", required = true) String serviceName) {
+ try {
+ services.getService(serviceName).keepAlive();
+ return new ResponseEntity<>("OK", HttpStatus.OK);
+ } catch (ServiceException e) {
+ return new ResponseEntity<>(e.getMessage(), HttpStatus.NOT_FOUND);