diff options
author | Brinda Santh <bs2796@att.com> | 2020-01-17 15:08:46 -0500 |
---|---|---|
committer | Brinda Santh <bs2796@att.com> | 2020-01-17 15:08:46 -0500 |
commit | fed6c23200eba54f0f1995e56bbaf6a6c1f42396 (patch) | |
tree | cf7b8bef791b82deaf9b9e913db5ac24d95cca2c /ms/blueprintsprocessor | |
parent | 8029f8e5332f107267ec11293c3099e54e87c67b (diff) |
Fix scheduler shutdown config function.
Optimize application name accessing in Docker Compose.
Issue-ID: CCSDK-1917
Signed-off-by: Brinda Santh <bs2796@att.com>
Change-Id: I6b055de7ef5a8ac4a0c103499997ed272bd74ac6
Diffstat (limited to 'ms/blueprintsprocessor')
7 files changed, 17 insertions, 19 deletions
diff --git a/ms/blueprintsprocessor/application/src/main/dc/docker-compose-cluster.yaml b/ms/blueprintsprocessor/application/src/main/dc/docker-compose-cluster.yaml index 7159534ba..d53b85f98 100644 --- a/ms/blueprintsprocessor/application/src/main/dc/docker-compose-cluster.yaml +++ b/ms/blueprintsprocessor/application/src/main/dc/docker-compose-cluster.yaml @@ -62,8 +62,7 @@ services: CLUSTER_STORAGE_PATH: /opt/app/onap/config/cluster #CLUSTER_CONFIG_FILE: /opt/app/onap/config/atomix/atomix-multicast.conf NATS_CLUSTER_ID: cds-cluster - NATS_HOSTS: nats://nats:4222 - APPLICATIONNAME: cds-controller + APP_NAME: cds-controller BUNDLEVERSION: 1.0.0 APP_CONFIG_HOME: /opt/app/onap/config STICKYSELECTORKEY: @@ -96,8 +95,7 @@ services: CLUSTER_STORAGE_PATH: /opt/app/onap/config/cluster #CLUSTER_CONFIG_FILE: /opt/app/onap/config/atomix/atomix-multicast.conf NATS_CLUSTER_ID: cds-cluster - NATS_HOSTS: nats://nats:4222 - APPLICATIONNAME: resource-resolution + APP_NAME: resource-resolution BUNDLEVERSION: 1.0.0 APP_CONFIG_HOME: /opt/app/onap/config STICKYSELECTORKEY: @@ -123,8 +121,7 @@ services: CLUSTER_NODE_ID: py-executor-0 CLUSTER_MEMBERS: cds-controller-0,resource-resolution-0,py-executor-0 NATS_CLUSTER_ID: cds-cluster - NATS_HOSTS: nats://nats:4222 - APPLICATIONNAME: py-executor + APP_NAME: py-executor BUNDLEVERSION: 1.0.0 APP_CONFIG_HOME: /opt/app/onap/config STICKYSELECTORKEY: diff --git a/ms/blueprintsprocessor/application/src/main/dc/docker-compose.yaml b/ms/blueprintsprocessor/application/src/main/dc/docker-compose.yaml index 8f2a78639..9f2a65d8b 100755 --- a/ms/blueprintsprocessor/application/src/main/dc/docker-compose.yaml +++ b/ms/blueprintsprocessor/application/src/main/dc/docker-compose.yaml @@ -36,6 +36,7 @@ services: cds-controller-default: depends_on: - db + - nats image: onap/ccsdk-blueprintsprocessor:latest container_name: cds-controller-default hostname: cds-controller-default @@ -53,7 +54,7 @@ services: type: volume source: controller-config environment: - APPLICATIONNAME: cds-controller + APP_NAME: cds-controller BUNDLEVERSION: 1.0.0 APP_CONFIG_HOME: /opt/app/onap/config STICKYSELECTORKEY: @@ -75,6 +76,7 @@ services: py-executor-default: depends_on: - db + - nats image: onap/ccsdk-py-executor container_name: py-executor-default hostname: py-executor-default @@ -88,7 +90,7 @@ services: type: volume source: blueprints-deploy environment: - APPLICATIONNAME: py-executor + APP_NAME: py-executor BUNDLEVERSION: 1.0.0 APP_CONFIG_HOME: /opt/app/onap/config STICKYSELECTORKEY: diff --git a/ms/blueprintsprocessor/application/src/main/docker/startService.sh b/ms/blueprintsprocessor/application/src/main/docker/startService.sh index f516a3c57..a9d3992a2 100644 --- a/ms/blueprintsprocessor/application/src/main/docker/startService.sh +++ b/ms/blueprintsprocessor/application/src/main/docker/startService.sh @@ -8,7 +8,7 @@ export APP_HOME=/opt/app/onap keytool -import -noprompt -trustcacerts -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit -alias ONAP -import -file $APP_CONFIG_HOME/ONAP_RootCA.cer exec java -classpath "/etc:${APP_HOME}/lib/*:/lib/*:/src:/schema:/generated-sources:${APP_CONFIG_HOME}:${APP_HOME}" \ --DappName=${APPLICATIONNAME} -DappVersion=${BUNDLEVERSION} \ +-DappName=${APP_NAME} -DappVersion=${BUNDLEVERSION} \ -DrouteOffer=${ROUTEOFFER} \ -DVERSION_ROUTEOFFER_ENVCONTEXT=${BUNDLEVERSION}/${STICKYSELECTORKEY}/${ENVCONTEXT} \ -DSecurityFilePath=/etc \ @@ -16,6 +16,6 @@ exec java -classpath "/etc:${APP_HOME}/lib/*:/lib/*:/src:/schema:/generated-sour -Dms_name=org.onap.ccsdk.cds.blueprintsprocessor \ -Dlogging.config=${APP_CONFIG_HOME}/logback.xml \ -Djava.security.egd=file:/dev/./urandom \ --DAPPNAME=${APPLICATIONNAME} -DAPPENV=${APP_ENV} -DAPPVERSION=${APP_VERSION} -DNAMESPACE=${NAMESPACE} \ +-DAPPNAME=${APP_NAME} -DAPPENV=${APP_ENV} -DAPPVERSION=${APP_VERSION} -DNAMESPACE=${NAMESPACE} \ -Dspring.config.location=${APP_CONFIG_HOME}/ \ org.onap.ccsdk.cds.blueprintsprocessor.BlueprintProcessorApplicationKt diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationSchedulerService.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationSchedulerService.kt index 2f08c1c34..aaefcc773 100644 --- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationSchedulerService.kt +++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/service/MessagePrioritizationSchedulerService.kt @@ -38,10 +38,10 @@ open class MessagePrioritizationSchedulerService( /** This is sample scheduler implementation used during starting application with configuration. @EventListener(ApplicationReadyEvent::class) open fun init() = runBlocking { - log.info("Starting PrioritizationListeners...") - startScheduling(MessagePrioritizationSample.samplePrioritizationConfiguration()) + log.info("Starting PrioritizationListeners...") + startScheduling(MessagePrioritizationSample.samplePrioritizationConfiguration()) } - */ + */ open suspend fun startScheduling() { val prioritizationConfiguration = messagePrioritizationService.getConfiguration() @@ -55,8 +55,9 @@ open class MessagePrioritizationSchedulerService( } } - open suspend fun shutdownScheduling(prioritizationConfiguration: PrioritizationConfiguration) { + open suspend fun shutdownScheduling() { keepGoing = false + val prioritizationConfiguration = messagePrioritizationService.getConfiguration() delay(prioritizationConfiguration.shutDownConfiguration.waitMill) } diff --git a/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumerTest.kt b/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumerTest.kt index 7f150f5f3..35bc49402 100644 --- a/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumerTest.kt +++ b/ms/blueprintsprocessor/functions/message-prioritizaion/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/message/prioritization/MessagePrioritizationConsumerTest.kt @@ -207,7 +207,7 @@ open class MessagePrioritizationConsumerTest { launch { /** To debug increase the delay time */ delay(20) - messagePrioritizationSchedulerService.shutdownScheduling(configuration) + messagePrioritizationSchedulerService.shutdownScheduling() } } } diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt index d1254b24e..50cc44279 100644 --- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt +++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BluePrintConstants.kt @@ -24,9 +24,7 @@ package org.onap.ccsdk.cds.controllerblueprints.core */ object BluePrintConstants { - val APP_NAME = System.getProperty("APPLICATION_NAME") - ?: System.getProperty("APP_NAME") - ?: System.getProperty("APPNAME") + val APP_NAME = System.getenv("APP_NAME") ?: "cds-controller" const val DATE_TIME_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" diff --git a/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/TokenAuthNatsService.kt b/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/TokenAuthNatsService.kt index 43a43bc03..7c24b70d0 100644 --- a/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/TokenAuthNatsService.kt +++ b/ms/blueprintsprocessor/modules/commons/nats-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/nats/service/TokenAuthNatsService.kt @@ -35,7 +35,7 @@ open class TokenAuthNatsService(private val natsConnectionProperties: TokenAuthN if (!::streamingConnection.isInitialized) { log.info( "NATS connection requesting for cluster(${natsConnectionProperties.clusterId}) with" + - "clientId($natsConnectionProperties.clientId)" + "clientId(${natsConnectionProperties.clientId})" ) val serverList = natsConnectionProperties.host.splitCommaAsList() |