kafka-main.go
package main
import (
"bufio"
"kafka/consumer"
"kafka/es"
"kafka/producer"
"os"
"strings"
)
var inputReader *bufio.Reader
func init() {
inputReader = bufio.NewReader(os.Stdin)
}
func CRead() string {
input, _ := inputReader.ReadString('\n')
return strings.TrimSpace(strings.TrimSuffix(input, "\n"))
}
func main() {
input := CRead()
if input == "1" {
producer.Test()
for {
producer.Run(CRead)
}
}
if input == "2" {
consumer.Test()
consumer.Run()
}
if input == "3" {
es.Connect()
es.Get()
}
}