confluent-kafka-python icon indicating copy to clipboard operation
confluent-kafka-python copied to clipboard

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

Open lunastral opened this issue 1 year ago • 0 comments

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:

  • [x] confluent-kafka-python and librdkafka version: 2.3.0
  • [x] Apache Kafka broker version: 2.8
  • [x] Client configuration: {'bootstrap.servers': xxx, 'security.protocol': 'SASL_PLAINTEXT', 'sasl.mechanism': 'SCRAM-SHA-256', 'sasl.username': xxx, 'sasl.password': xxx}
  • [x] Operating system: Windows 11
  • [x] Provide client logs (with 'debug': '..' as necessary)
  • [ ] Provide broker log excerpts
  • [x] Critical issue

lunastral avatar Dec 29 '23 18:12 lunastral