From 4ce42126bd145ef3fadab682e98d6922df8c0b0e Mon Sep 17 00:00:00 2001 From: Surabhi <surabhi.mahawar@aurigait.com> Date: Mon, 8 Aug 2022 11:58:42 +0530 Subject: [PATCH] service - health --- .../health/ServiceStatusController.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/com/uci/outbound/health/ServiceStatusController.java b/src/main/java/com/uci/outbound/health/ServiceStatusController.java index ee7deab..34789c9 100644 --- a/src/main/java/com/uci/outbound/health/ServiceStatusController.java +++ b/src/main/java/com/uci/outbound/health/ServiceStatusController.java @@ -28,6 +28,26 @@ public class ServiceStatusController { @Autowired private HealthService healthService; + /** + * In use by sunbird team - to check service liveliness & readliness + * @return + * @throws JsonProcessingException + */ + @RequestMapping(value = "/health", method = RequestMethod.GET, produces = { "application/json", "text/json" }) + public ResponseEntity<ApiResponse> statusCheck() throws JsonProcessingException { + ObjectMapper mapper = new ObjectMapper(); + JsonNode resultNode = mapper.readTree("{\"healthy\":true}"); + + ApiResponse response = ApiResponse.builder() + .id("api.service.health.cassandra") + .params(ApiResponseParams.builder().build()) + .responseCode(HttpStatus.OK.name()) + .result(resultNode) + .build(); + + return ResponseEntity.ok(response); + } + @RequestMapping(value = "/health/cassandra", method = RequestMethod.GET, produces = { "application/json", "text/json" }) public ResponseEntity<ApiResponse> cassandraStatusCheck() throws IOException, JsonProcessingException { ApiResponse response = ApiResponse.builder()