7d8138639222bea3e42356a3c6e2324e52670bd9
[ccsdk/cds.git] /
1 /*
2  *  Copyright © 2019 IBM.
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.onap.ccsdk.cds.blueprintsprocessor.message.service
18
19 import kotlinx.coroutines.runBlocking
20
21 interface BlueprintMessageProducerService {
22
23     fun sendMessage(message: Any): Boolean {
24         return sendMessage(message = message, headers = null)
25     }
26
27     fun sendMessage(topic: String, message: Any): Boolean {
28         return sendMessage(topic, message, null)
29     }
30
31     fun sendMessage(message: Any, headers: MutableMap<String, String>?): Boolean = runBlocking {
32         sendMessageNB(message = message, headers = headers)
33     }
34
35     fun sendMessage(topic: String, message: Any, headers: MutableMap<String, String>?): Boolean = runBlocking {
36         sendMessageNB(topic, message, headers)
37     }
38
39     suspend fun sendMessageNB(message: Any): Boolean {
40         return sendMessageNB(message = message, headers = null)
41     }
42
43     suspend fun sendMessageNB(message: Any, headers: MutableMap<String, String>?): Boolean
44
45     suspend fun sendMessageNB(topic: String, message: Any): Boolean {
46         return sendMessageNB(topic, message, null)
47     }
48
49     suspend fun sendMessageNB(topic: String, message: Any, headers: MutableMap<String, String>?): Boolean
50 }