有人知道如何使用Sarama在ApacheKafka中创建多订阅主题
我有一个简单的消费者,我需要订阅三个不同的主题
topic := "Payments" // need to be "Payments","System","Orders" consumer, err := master.ConsumePartition(topic, 0, sarama.OffsetOldest) if err != nil { panic(err) }
Sarama Cluster 帮了我一把
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()