forked from RonnanSouza/kafka_environment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
29 lines (22 loc) · 725 Bytes
/
main.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
package main
import (
"gopkg.in/alecthomas/kingpin.v2"
"github.com/RonnanSouza/kafka_environment/consumer"
"github.com/RonnanSouza/kafka_environment/producer"
)
func main() {
var (
isConsumer = kingpin.Flag("consumer", "Use this flag to start a Kafka Consumer.").Default("false").Bool()
isProducer = kingpin.Flag("producer", "Use this flag to start a Kafka Producer.").Default("false").Bool()
kafkaURIs = []string{}
)
kingpin.Flag("kafka.server", "Address (host:port) of Kafka server.").Required().StringsVar(&kafkaURIs)
kingpin.HelpFlag.Short('h')
kingpin.Parse()
// Decision Time
if *isProducer {
producer.StartProducer(kafkaURIs)
} else if *isConsumer {
consumer.StartConsumer(kafkaURIs)
}
}