Skip to content

Commit

Permalink
Merge pull request #55 from areeda/Kafka-exception-catch
Browse files Browse the repository at this point in the history
Stop Kafka errors propagating and allow the consumer to retry indefinitely
  • Loading branch information
cnweaver authored Apr 1, 2022
2 parents 8dcbe7b + a33abdd commit 0d38c10
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion adc/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ def _stream_forever(self,
batch_timeout: timedelta = timedelta(seconds=1.0),
) -> Iterator[confluent_kafka.Message]:
while True:
messages = self._consumer.consume(batch_size, batch_timeout.total_seconds())
try:
messages = self._consumer.consume(batch_size,
batch_timeout.total_seconds())
for m in messages:
err = m.error()
if err is None:
Expand Down

0 comments on commit 0d38c10

Please sign in to comment.