I want to store big files in Kafka, using metadata about the record to retrieve them in the future.
So I send around messages containing the topic, partition_id, offset and then I try to retrieve the file in this way:
def retrieve_file_from_kafka(topic_name, partition_id, offset):
client = KafkaClient(hosts=BROKER_ADDRESS, broker_version="0.10.1.0")
topic = client.topics[bytes(topic_name, "UTF-8")]
consumer = topic.get_balanced_consumer(
consumer_group=bytes("file_retrieve" + topic_name + str(partition_id) + str(offset), "UTF-8"))
consumer.reset_offsets([(topic.partitions[partition_id], offset)])
return consumer.consume()
It doesn't work though and just prints:
Offset reset for partition 0 to timestamp 8 failed. Setting partition 0's internal counter to 8
This error is quite cryptical and it happens on the reset_offsets. When I try to consume, the process is then stuck waiting for the rebalancing_lock. What am I doing wrong?