Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

消费指定时间offset的问题 #1

Open
lwbaptx opened this issue Oct 28, 2019 · 1 comment
Open

消费指定时间offset的问题 #1

lwbaptx opened this issue Oct 28, 2019 · 1 comment

Comments

@lwbaptx
Copy link

lwbaptx commented Oct 28, 2019

consumer_timestamp_window.py
这个消费指定时间的offset的。

    for topic_partition, offset_and_timestamp in begin_offset_dic.items():  
        self.consumer.seek(topic_partition, offset_and_timestamp[0])

    self.consumer.subscribe(self.topic)  
    self.consumer.poll(0)

这两行代码是不是应该调转过来,否则会报错
AssertionError: Unassigned partition

@YHYR
Copy link
Owner

YHYR commented Oct 28, 2019

OK,是的;需要先通过subscribe订阅Topic,然后通过poll(0)来由客户端来分配分区;才能通过seek改变指定Partition的offset;多谢指正

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants