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