blob: cb33a353bd99a46a5c10b693c8d062c4412bc706 [file] [log] [blame]
khenaidoo43c82122018-11-22 18:38:28 -05001/*
2 * Copyright 2018-present Open Networking Foundation
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 */
16package kafka
17
18import (
19 ca "github.com/opencord/voltha-go/protos/core_adapter"
20)
21
22const (
23 DefaultKafkaHost = "127.0.0.1"
24 DefaultKafkaPort = 9092
25 DefaultGroupName = "rw_core"
26 DefaultSleepOnError = 1
27 DefaultFlushFrequency = 1
28 DefaultFlushMessages = 1
29 DefaultFlushMaxmessages = 1
30 DefaultReturnSuccess = false
31 DefaultReturnErrors = true
32 DefaultConsumerMaxwait = 10
33 DefaultMaxProcessingTime = 100
34)
35
36// MsgClient represents the set of APIs a Kafka MsgClient must implement
37type Client interface {
38 Start(retries int) error
39 Stop()
40 CreateTopic(topic *Topic, numPartition int, repFactor int, retries int) error
41 DeleteTopic(topic *Topic) error
42 Subscribe(topic *Topic, retries int) (<-chan *ca.InterContainerMessage, error)
43 UnSubscribe(topic *Topic, ch <-chan *ca.InterContainerMessage) error
44 Send(msg interface{}, topic *Topic, keys ...string)
45}