-
Notifications
You must be signed in to change notification settings - Fork 225
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
[QUESTION] How to get old messages from topics? #998
Comments
You can start consuming without group from the beginning (see |
Thanks for your reply! Actually, I`ve tried this method, but I have stuck using it. I create test code snippet like this: import asyncio
from aiokafka import AIOKafkaConsumer, TopicPartition
async def test():
consumer = AIOKafkaConsumer("test", bootstrap_servers="localhost:9092")
try:
tp = TopicPartition(topic="test", partition=0)
consumer.assign([tp])
await consumer.seek_to_beginning(tp)
finally:
await consumer.stop()
if __name__ == "__main__":
asyncio.run(test()) Here I manually create partition, because raise IllegalStateError(
aiokafka.errors.IllegalStateError: IllegalStateError: Subscription to topics, partitions and pattern are mutually exclusive I don`t understand what I do incorrectly |
You don't need assignment if you don't use groups and not going to distribute messages among workers. But you need to seek for all partitions you have. Use |
I have also tried this method. It returns None, but my test topic has been created |
Of course, I can get the messages with consumer in real time
But what if I wanna get my old messages or find specific one from this topic?
The text was updated successfully, but these errors were encountered: