confluentinc / confluent-kafka-python

Confluent's Kafka Python Client
http://docs.confluent.io/current/clients/confluent-kafka-python
Other
3.73k stars 882 forks source link

please help me! I encountered difficulties using the "AdminClient. list_offsets" method #1696

Open testerHD opened 6 months ago

testerHD commented 6 months ago

Description

Hello!

I encountered difficulties using the "AdminClient. list_offsets" method, I want to obtain the timestamp corresponding to the offset, However, the timestamp obtained using the "result. timestamp" method is a negative timestamp(console: Timestamp: -1251536750), The timestamp of this message should be "1703850479000"

The code is as follows:

topic_partition_offsets = dict() topic_partition = TopicPartition(topic, partition) topic_partition_offsets[topic_partition] = OffsetSpec.for_timestamp(1703847600000) future_map = AdminClient({xxx}).list_offsets(topic_partition_offsets, request_timeout=15) for tp, future in future_map.items(): result = future.result() print(result.timestamp)

How to reproduce

Checklist

Please provide the following information: