THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Currently, we use KafkaConsumer to get offsets in GetOffsetShell, whereas the new OffsetSpec is only supported in AdminClient, so we need to change the client from KafkaConsumer to AdminClient.
Public Interfaces
...
This KIP change 2 parameters for command line tool kafka-get-offsets.sh. These 2 arguments are:
- --time , we could pass -1(latest), -2(earliest) or a specified timestamp currently, in this KIP, we support -3(max-timestamp) which is introduced in KIP-734.
- --command-config
...
- , currently the property file
...
- will be passed to KafkaConsumer Client, In this KIP, we change it to the property file of AdminClient.
here are some examples,
Code Block | ||
---|---|---|
| ||
# get the latest offset of topic1 :
bin/kafka-get-offsets.sh --bootstrap-server localhost:9092 --topic topic1 --time -1
# get the offset of max timestamp of topic1
bin/kafka-get-offsets.sh --bootstrap-server localhost:9092 --topic topic1 --time -3
# contents of kafka.properties
bootstrap.servers=localhost:9092
security.protocol=SASL_PLAINTEXT
sasl.mechanism=SCRAM-SHA-256
sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username="root" password="123456";
# get offset from sasl kafka broker
bin/kafka-get-offsets.sh --command-config kafka.properties --topic topic1 --time -1
|
Proposed Changes
- Support max timestamp in GetOffsetShell GetOffsetShell ,
- Support All AdminClient config in the file specified by --command-config, the only new config is
retries
, which means we will resend any request that fails when getting offsets. - Some old KafkaConsumer config will be ignored, for example, key.deserializer and value.deserializer
...