forked from obsidiandynamics/goharvest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
neli.go
35 lines (28 loc) · 1.17 KB
/
neli.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package goharvest
import "github.com/obsidiandynamics/goneli"
// NeliProvider is a factory for creating Neli instances.
type NeliProvider func(config goneli.Config, barrier goneli.Barrier) (goneli.Neli, error)
// StandardNeliProvider returns a factory for creating a conventional Neli instance, backed by the real client API.
func StandardNeliProvider() NeliProvider {
return func(config goneli.Config, barrier goneli.Barrier) (goneli.Neli, error) {
return goneli.New(config, barrier)
}
}
func configToNeli(hConfigMap KafkaConfigMap) goneli.KafkaConfigMap {
return map[string]interface{}(hConfigMap)
}
func configToHarvest(nConfigMap goneli.KafkaConfigMap) KafkaConfigMap {
return map[string]interface{}(nConfigMap)
}
func convertKafkaConsumerProvider(hProvider KafkaConsumerProvider) goneli.KafkaConsumerProvider {
return func(conf *goneli.KafkaConfigMap) (goneli.KafkaConsumer, error) {
hCfg := configToHarvest(*conf)
return hProvider(&hCfg)
}
}
func convertKafkaProducerProvider(hProvider KafkaProducerProvider) goneli.KafkaProducerProvider {
return func(conf *goneli.KafkaConfigMap) (goneli.KafkaProducer, error) {
hCfg := configToHarvest(*conf)
return hProvider(&hCfg)
}
}