65b7644a87fe3273b38b9998c71f7045b005c44a
[ccsdk/cds.git] /
1 /*
2  * Copyright © 2018-2019 AT&T Intellectual Property.
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.functions.message.prioritization
18
19 import java.io.Serializable
20
21 object MessageActionConstants {
22
23     const val PRIORITIZE = "prioritize"
24 }
25
26 enum class MessageState(val id: String) {
27     NEW("new"),
28     WAIT("wait"),
29     EXPIRED("expired"),
30     PRIORITIZED("prioritized"),
31     AGGREGATED("aggregated"),
32     COMPLETED("completed"),
33     ERROR("error")
34 }
35
36 open class PrioritizationConfiguration : Serializable {
37
38     lateinit var expiryConfiguration: ExpiryConfiguration
39     lateinit var shutDownConfiguration: ShutDownConfiguration
40     lateinit var cleanConfiguration: CleanConfiguration
41     var kafkaConfiguration: KafkaConfiguration? = null // Optional Kafka Consumer Configuration
42     var natsConfiguration: NatsConfiguration? = null // Optional NATS Consumer Configuration
43 }
44
45 open class KafkaConfiguration : Serializable {
46
47     lateinit var inputTopicSelector: String // Consumer Configuration Selector
48     lateinit var expiredTopic: String // Publish Configuration Selector
49     lateinit var outputTopic: String // Publish Configuration Selector
50 }
51
52 open class NatsConfiguration : Serializable {
53
54     lateinit var connectionSelector: String // Consumer Configuration Selector
55     lateinit var inputSubject: String // Publish Configuration Selector
56     lateinit var expiredSubject: String // Publish Configuration Selector
57     lateinit var outputSubject: String // Publish Configuration Selector
58 }
59
60 open class ExpiryConfiguration : Serializable {
61
62     var frequencyMilli: Long = 30000L
63     var maxPollRecord: Int = 1000
64 }
65
66 open class ShutDownConfiguration : Serializable {
67
68     var waitMill: Long = 30000L
69 }
70
71 open class CleanConfiguration : Serializable {
72
73     var frequencyMilli: Long = 30000L
74     var expiredRecordsHoldDays: Int = 5
75 }
76
77 open class UpdateStateRequest : Serializable {
78
79     lateinit var id: String
80     var group: String? = null
81     var state: String? = null
82 }
83
84 data class CorrelationCheckResponse(
85     var message: String? = null,
86     var correlated: Boolean = false
87 )
88
89 data class TypeCorrelationKey(val type: String, val correlationId: String)