package kafka import ( "context" "github.com/segmentio/kafka-go" ) type KafkaReader struct { ctx context.Context reader *kafka.Reader first string topic string } func NewReader(ctx context.Context, topic string, address ...string) *KafkaReader { return &KafkaReader{ ctx: ctx, reader: kafka.NewReader(kafka.ReaderConfig{ Topic: topic, Brokers: address, GroupID: "consumer-group-id", // TODO Partition: 0, // TODO MinBytes: 10e3, // 10KB MaxBytes: 10e6, // 10MB }), first: address[0], topic: topic, } } func (s *KafkaReader) Close() error { return s.reader.Close() } func (s *KafkaReader) ReadMessage(key string, value string) error { return nil }