Search code examples
goapache-kafkasarama

What happens in Sarama library when a consumer tries to connect to a down broker?


What happens in Sarama library when a consumer tries to connect to a down broker? Does it return an error?


Solution

  • If those topics have a replication factor of higher than one, and there was a leader election to a new broker for those topic partitions, then the consumer would rebalance to the leader partition.

    In the 2.4 release of Kafka, clients will be able to read from in-sync replicas as well instead of only the leader broker, however that capability would need added in Sarama's protocols.

    If there is only one broker available for a partition, and it is down, then Sarama and all other clients reading and writing to the topic would throw errors, yes.