goka框架:https://blog.csdn.net/studyhard232/article/details/88557962
https://studygolang.com/articles/24483
https://www.ctolib.com/lovoo-goka.html
package main
import (
"context"
"fmt"
"log"
"os"
"os/signal"
"syscall"
"github.com/lovoo/goka"
"github.com/lovoo/goka/codec"
)
var (
brokers = []string{"localhost:9092"}
topic goka.Stream = "example-stream"
group goka.Group = "example-group"
)
// emits a single message and leave
func runEmitter() {
emitter, err := goka.NewEmitter(brokers, topic, new(codec.String))
if err != nil {
log.Fatalf("error creating emitter: %v", err)
}
defer emitter.Finish()