59e3606eae6530cff30fbdd9bfc5fdd4db2ac790
[ccsdk/cds.git] /
1 /*
2  *  Copyright © 2019 IBM.
3  *  Modifications Copyright © 2018-2019 AT&T Intellectual Property.
4  *
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
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  */
17
18 package org.onap.ccsdk.cds.blueprintsprocessor.message
19
20 import org.apache.kafka.streams.StreamsConfig
21
22 /** Producer Properties **/
23 open class MessageProducerProperties
24
25 open class KafkaBasicAuthMessageProducerProperties : MessageProducerProperties() {
26     lateinit var bootstrapServers: String
27     var topic: String? = null
28     var clientId: String? = null
29     // strongest producing guarantee
30     var acks: String = "all"
31     var retries: Int = 0
32     // ensure we don't push duplicates
33     var enableIdempotence: Boolean = true
34 }
35
36 /** Consumer Properties **/
37
38 open class MessageConsumerProperties
39
40 open class KafkaStreamsConsumerProperties : MessageConsumerProperties() {
41     lateinit var bootstrapServers: String
42     lateinit var applicationId: String
43     lateinit var topic: String
44     var autoOffsetReset: String = "latest"
45     var processingGuarantee: String = StreamsConfig.EXACTLY_ONCE
46 }
47
48 open class KafkaStreamsBasicAuthConsumerProperties : KafkaStreamsConsumerProperties()
49
50 open class KafkaMessageConsumerProperties : MessageConsumerProperties() {
51     lateinit var bootstrapServers: String
52     lateinit var groupId: String
53     lateinit var clientId: String
54     var topic: String? = null
55     var autoCommit: Boolean = true
56     var autoOffsetReset: String = "latest"
57     var pollMillSec: Long = 1000
58     var pollRecords: Int = -1
59 }
60
61 open class KafkaBasicAuthMessageConsumerProperties : KafkaMessageConsumerProperties()