bsm / sarama-cluster

Cluster extensions for Sarama, the Go client library for Apache Kafka 0.9 [DEPRECATED]
MIT License
1.01k stars 222 forks source link

Consumer per topic vs multiple topics per consumer #286

Closed saraweinberg closed 5 years ago

saraweinberg commented 5 years ago

I have a micro service that should consume from multiple topics. I wonder what is better to implement:

1. One consumer that consume from a list of topics cluster, err := cluster.NewConsumer(BROKERS, GropuID, topicNames, config) and then I have one go channel with switch case to handle proper logic per topic. 2.One consumer per topic cluster, err := cluster.NewConsumer(BROKERS, GropuID, topic_1, config) cluster, err := cluster.NewConsumer(BROKERS, GropuID, topic_2, config) ... (or NewConsumerFromClient) With N go channels (one channel per topic...) ?

dim commented 5 years ago

please note https://github.com/bsm/sarama-cluster#deprecation-notice