-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.go
33 lines (27 loc) · 983 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
30
31
32
33
package main
import (
"flag"
"fmt"
"github.com/RonnanSouza/kafka_environment/consumer"
"github.com/RonnanSouza/kafka_environment/producer"
)
func main() {
// Flags
consumerFlagValue := flag.Bool("c", false, " Use this flag to start a Kafka Consumer")
producerFlagValue := flag.Bool("p", false, " Use this flag to start a Kafka Producer")
stringFlagValue := flag.String("a", "", " Use this flag with either \"consumer\" or \"producer\"")
// Flag Processing
flag.Parse()
// Decision Time
if *producerFlagValue == true {
producer.StartProducer()
} else if *consumerFlagValue == true {
consumer.StartConsumer()
} else if *stringFlagValue == "consumer" {
consumer.StartConsumer()
} else if *stringFlagValue == "producer" {
producer.StartProducer()
} else {
fmt.Print("Usage: \n -c Use this flag to start a Kafka Consumer\n -p Use this flag to start a Kafka Producer\n -a Use this flag with either \"consumer\" or \"producer\"\n")
}
}