ソースを参照

consumer: silently skip messages already consumed

It seems that sometimes the broker can return us messages we've already seen,
and that this is legitimate, so we shouldn't produce errors, just quietly ignore
them.

Possibly fixes #166 pending confirmation from upstream
(https://issues.apache.org/jira/browse/KAFKA-1744).
Evan Huus 11 年 前
コミット
64e556f2c9
1 ファイル変更3 行追加1 行削除
  1. 3 1
      consumer.go

+ 3 - 1
consumer.go

@@ -267,7 +267,9 @@ func (c *Consumer) fetchMessages() {
 			for _, msg := range msgBlock.Messages() {
 
 				event := &ConsumerEvent{Topic: c.topic, Partition: c.partition}
-				if msg.Offset != c.offset {
+				if msg.Offset < c.offset {
+					continue
+				} else if msg.Offset > c.offset {
 					event.Err = IncompleteResponse
 				} else {
 					event.Key = msg.Msg.Key