Skip to content

Commit f9f18bd

Browse files
committed
提交过offset,latest和earliest没有区别,但是在没有提交offset情况下,用latest直接会导致无法读取旧数据
1 parent 2e86cf9 commit f9f18bd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

爬虫代码/Python消费kafka指定时间戳数据.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ from kafka import KafkaConsumer, TopicPartition
1616
#latest 和 earliest 区别
1717
#1,earliest 当各分区下有已提交的offset时,从提交的offset开始消费;无提交的offset时,从头开始消费
1818
#2,latest 当各分区下有已提交的offset时,从提交的offset开始消费;无提交的offset时,消费新产生的该分区下的数据
19-
19+
#提交过offset,latest和earliest没有区别,但是在没有提交offset情况下,用latest直接会导致无法读取旧数据。
2020
class ConsumerTimeStampWindow:
2121
def __init__(self, broker_list, group_name, topic, enable_auto_commit=True, auto_offset_reset='latest'):
2222
self.topic = topic

0 commit comments

Comments
 (0)