Untitled

mail@pastecode.io avatar
unknown
golang
3 years ago
403 B
5
Indexable
func main() {
	app.LoadEvnVars()
	cfg, err := app.BuildConfig(context.Background())
	if err != nil {
		log.Fatal(err)
	}
	
	if err != nil {
		log.Fatal(err)
	}

	handler := func(msg []byte) error {
		log.Printf("Message consumed %s:", string(msg))
		
		// ... logic here
	}

	consumer := kafka.CreateConsumerFactory(cfg.KafkaBrokers)("topic", "group-id", handler)
	consumer.Start(context.Background())
}