Consuming messages from Kafka

Consuming Messages from a Kafka broker is a little bit more complex than in AMQP. You have already learned that a Kafka topic may consist of many partitions that each consumer can consume one or more (up to all) of these partitions. Kafka architectures allow horizontal scaling by dividing a topic into more partitions and having one consumer subscribe to each partition.

This means that each subscriber needs to know which partitions of a topic exist and which of those it should consume. Some of the libraries that we introduced earlier in this section (especially the Confluent library) actually support automatic subscriber partitioning and automatic group balancing. The sarama library does not offer this feature, ...

Get Cloud Native programming with Golang now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.