0

Someone knows how to make a multi-subscription topics in Apache Kafka using Sarama

I have a simple consumer, and I need to subscribe to three different topics

topic := "Payments" // need to be "Payments","System","Orders"

consumer, err := master.ConsumePartition(topic, 0, sarama.OffsetOldest)
if err != nil {
    panic(err)
}
Stremovskyy
  • 452
  • 7
  • 18

1 Answers1

0

Sarama Cluster helped for me

    brokers := []string{"127.0.0.1:9092"}
    topics := []string{"my_topic", "other_topic"}
    consumer, err := cluster.NewConsumer(brokers, "my-consumer-group", topics, config)
    if err != nil {
        panic(err)
    }
    defer consumer.Close()
Stremovskyy
  • 452
  • 7
  • 18