forked from Accedian/godruid
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathio_config.go
33 lines (29 loc) · 1.27 KB
/
io_config.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
package godruid
type IOConfig interface{}
type ioConfigKafka struct {
Type string `json:"type"`
ConsumerProperties *ConsumerProperties `json:"consumerProperties"`
Topic string `json:"topic"`
LatestMessageRejectPeriod string `json:"lateMessageRejectionPeriod,omitempty"`
EarlyMessageRejectionPeriod string `json:"earlyMessageRejectionPeriod,omitempty"`
}
func IOConfigKafka(topic, latestMessageRejectPeriod, earlyMessageRejectionPeriod, bootstrapServers, saslMechanism, securityProtocal, sasLJAASConfig string) IOConfig {
return &ioConfigKafka{
Type: "kafka",
Topic: topic,
LatestMessageRejectPeriod: latestMessageRejectPeriod,
EarlyMessageRejectionPeriod: earlyMessageRejectionPeriod,
ConsumerProperties: &ConsumerProperties{
BootstrapServers: bootstrapServers,
SASLMechanism: saslMechanism,
SecurityProtocal: securityProtocal,
SASLJAASConfig: sasLJAASConfig,
},
}
}
type ConsumerProperties struct {
BootstrapServers string `json:"bootstrap.servers"`
SASLMechanism string `json:"sasl.mechanism"`
SecurityProtocal string `json:"security.protocol"`
SASLJAASConfig string `json:"sasl.jaas.config"`
}