aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/application
diff options
context:
space:
mode:
authorShaabanEltanany <shaaban.eltanany.ext@orange.com>2019-12-04 11:59:15 +0200
committerShaabanEltanany <shaaban.eltanany.ext@orange.com>2019-12-04 12:29:37 +0200
commit80da76b7044ce4615b986136210c4520762debf7 (patch)
tree6742c397ac4af59be3ff6d157bbbd02b269e7d4d /ms/blueprintsprocessor/application
parent98831362ddb13e1888bedca4f4e03df8c4e7d9e4 (diff)
Add default values for health-api properties
Issue-ID: CCSDK-1669 Signed-off-by: ShaabanEltanany <shaaban.eltanany.ext@orange.com> Change-Id: I28d6c829a8f6d41aee52a21b9391b7f642359756
Diffstat (limited to 'ms/blueprintsprocessor/application')
-rw-r--r--ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt25
1 files changed, 18 insertions, 7 deletions
diff --git a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt
index 8d4a27fc0..8fcffbf06 100644
--- a/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt
+++ b/ms/blueprintsprocessor/application/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/actuator/indicator/BluePrintCustomIndicator.kt
@@ -16,9 +16,11 @@
package org.onap.ccsdk.cds.blueprintsprocessor.actuator.indicator
+import kotlinx.coroutines.runBlocking
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthApiResponse
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.domain.HealthCheckStatus
import org.onap.ccsdk.cds.blueprintsprocessor.healthapi.service.health.BluePrintProcessorHealthCheck
+import org.slf4j.LoggerFactory
import org.springframework.boot.actuate.health.AbstractHealthIndicator
import org.springframework.boot.actuate.health.Health
import org.springframework.stereotype.Component
@@ -30,16 +32,25 @@ import org.springframework.stereotype.Component
*/
@Component
open class BluePrintCustomIndicator(private val bluePrintProcessorHealthCheck: BluePrintProcessorHealthCheck) :
- AbstractHealthIndicator() {
+ AbstractHealthIndicator() {
+
+ private var logger = LoggerFactory.getLogger(BluePrintCustomIndicator::class.java)
@Throws(Exception::class)
override fun doHealthCheck(builder: Health.Builder) {
- var result: HealthApiResponse? = bluePrintProcessorHealthCheck!!.retrieveEndpointExecutionStatus()
- if (result?.status == HealthCheckStatus.UP) {
- builder.up()
- } else {
- builder.down()
+ runBlocking {
+ var result: HealthApiResponse? = null
+ try {
+ result = bluePrintProcessorHealthCheck!!.retrieveEndpointExecutionStatus()
+ if (result?.status == HealthCheckStatus.UP) {
+ builder.up()
+ } else {
+ builder.down()
+ }
+ builder.withDetail("Services", result?.checks)
+ } catch (exception: IllegalArgumentException) {
+ logger.error(exception.message)
+ }
}
- builder.withDetail("Services", result?.checks)
}
}