Skip to content

Instantly share code, notes, and snippets.

Last active Jul 25, 2021
What would you like to do?
package main
import (
func consume(ctx context.Context) {
dialer := saslScramDialer()
r := kafka.NewReader(kafka.ReaderConfig{
Brokers: brokers,
Topic: topic2,
GroupID: group,
Logger: kafka.LoggerFunc(log.Debugf),
Dialer: dialer,
for {
msg, err := r.ReadMessage(ctx)
if err != nil {
log.Panicf("%v could not read message: %v", getHostname(), err.Error())
log.Debugf("%v received message: %v", getHostname(), string(msg.Value))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment