2 * Copyright © 2019 IBM.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.onap.ccsdk.cds.blueprintsprocessor.message
20 import com.fasterxml.jackson.databind.JsonNode
21 import org.onap.ccsdk.cds.blueprintsprocessor.message.service.BluePrintMessageLibPropertyService
22 import org.onap.ccsdk.cds.blueprintsprocessor.message.service.BlueprintMessageConsumerService
23 import org.onap.ccsdk.cds.blueprintsprocessor.message.service.BlueprintMessageProducerService
24 import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService
25 import org.springframework.boot.context.properties.EnableConfigurationProperties
26 import org.springframework.context.annotation.ComponentScan
27 import org.springframework.context.annotation.Configuration
31 @EnableConfigurationProperties
32 open class BluePrintMessageLibConfiguration
35 * Exposed Dependency Service by this Message Lib Module
37 fun BluePrintDependencyService.messageLibPropertyService(): BluePrintMessageLibPropertyService =
38 instance(MessageLibConstants.SERVICE_BLUEPRINT_MESSAGE_LIB_PROPERTY)
40 /** Extension functions for message producer service **/
41 fun BluePrintDependencyService.messageProducerService(selector: String): BlueprintMessageProducerService {
42 return messageLibPropertyService().blueprintMessageProducerService(selector)
46 fun BluePrintDependencyService.messageProducerService(jsonNode: JsonNode): BlueprintMessageProducerService {
47 return messageLibPropertyService().blueprintMessageProducerService(jsonNode)
50 /** Extension functions for message consumer service **/
51 fun BluePrintDependencyService.messageConsumerService(selector: String): BlueprintMessageConsumerService {
52 return messageLibPropertyService().blueprintMessageConsumerService(selector)
55 fun BluePrintDependencyService.messageConsumerService(jsonNode: JsonNode): BlueprintMessageConsumerService {
56 return messageLibPropertyService().blueprintMessageConsumerService(jsonNode)
59 class MessageLibConstants {
61 const val SERVICE_BLUEPRINT_MESSAGE_LIB_PROPERTY = "blueprint-message-lib-property-service"
62 //TODO("Change to .messageconsumer in application.properties")
63 const val PROPERTY_MESSAGE_CONSUMER_PREFIX = "blueprintsprocessor.messageclient."
64 const val PROPERTY_MESSAGE_PRODUCER_PREFIX = "blueprintsprocessor.messageproducer."
65 const val TYPE_KAFKA_BASIC_AUTH = "kafka-basic-auth"