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()
}

}

posted on 2023-07-13 19:24  木林coder  阅读(2)  评论(0编辑  收藏  举报

导航