class GlobalHealthcheckHandler {

    @GET
    @Produces("application/json")
    @Operation(description = "Performing global health check", responses = @ApiResponse(
            content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
    @Transactional
    public Response globalHealthcheck(@DefaultValue("true") @QueryParam("enableBpmn") boolean enableBpmn,
            @Context ContainerRequestContext requestContext) {
        Response HEALTH_CHECK_RESPONSE = null;
        // Build internal response object
        HealthCheckResponse rsp = new HealthCheckResponse();

        try {
            // Generated RequestId
            String requestId = requestContext.getProperty("requestId").toString();
            logger.info(LoggingAnchor.TWO, MessageEnum.APIH_GENERATED_REQUEST_ID.toString(), requestId);

            List<Endpoint> endpoints = config.getEndpoints().stream().filter(item -> {
                if (!enableBpmn && SoSubsystems.BPMN.equals(item.getSubsystem())) {
                    return false;
                } else {
                    return true;
                }
            }).collect(Collectors.toList());

            for (Endpoint endpoint : endpoints) {
                rsp.getSubsystems().add(querySubsystemHealth(endpoint));
            }

            // set Message
            rsp.setMessage(String.format("HttpStatus: %s", HttpStatus.SC_OK));
            logger.info(rsp.toString());

            HEALTH_CHECK_RESPONSE = Response.status(HttpStatus.SC_OK).entity(rsp).build();

        } catch (Exception ex) {
            logger.error("Exception occurred", ex);
            rsp.setMessage(ex.getMessage());
            HEALTH_CHECK_RESPONSE = Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).entity(rsp).build();
        }

        return HEALTH_CHECK_RESPONSE;
    }

}