Background
In https://github.com/Shopify/sarama/issues/1192, a user reported seeing read tcp <ip>:63133-><ip>:9092: i/o timeout errors when consuming Kafka messages with a consumer group during rebalancing. As a response, Sarama updated their documentation and examples to indicate that the ConsumeClaim function should explicitly check for a completed Context (see: https://github.com/Shopify/sarama/pull/2240). It's possible that we may have run into the same problem when using nats-kafka, as we recently saw very similar errors in a production installation.
Background In https://github.com/Shopify/sarama/issues/1192, a user reported seeing
read tcp <ip>:63133-><ip>:9092: i/o timeout
errors when consuming Kafka messages with a consumer group during rebalancing. As a response, Sarama updated their documentation and examples to indicate that theConsumeClaim
function should explicitly check for a completedContext
(see: https://github.com/Shopify/sarama/pull/2240). It's possible that we may have run into the same problem when usingnats-kafka
, as we recently saw very similar errors in a production installation.Description With this PR, we're updating nats-kafka's Kafka Consumer to align with the updated usage advice from the Sarama developers (https://github.com/Shopify/sarama/blob/main/examples/consumergroup/main.go).