From 4c67df2c22aea1fdc388a7a9995656f529c338c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Casta=C3=B1o?= Date: Fri, 4 Mar 2016 19:25:29 +0100 Subject: [PATCH] Recover when messages are removed from kafka OffsetOutOfRange error can also happen when the returned offset is a positive number but corresponding messages started from the offset were retentioned. By @ymattw: https://github.com/bpot/poseidon/pull/102 --- lib/poseidon/partition_consumer.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/poseidon/partition_consumer.rb b/lib/poseidon/partition_consumer.rb index d90a64c..e585582 100644 --- a/lib/poseidon/partition_consumer.rb +++ b/lib/poseidon/partition_consumer.rb @@ -112,8 +112,7 @@ def fetch(options = {}) partition_response = topic_response.partition_fetch_responses.first unless partition_response.error == Errors::NO_ERROR_CODE - if @offset < 0 && - Errors::ERROR_CODES[partition_response.error] == Errors::OffsetOutOfRange + if Errors::ERROR_CODES[partition_response.error] == Errors::OffsetOutOfRange @offset = :earliest_offset return fetch(options) end