ijuma commented on a change in pull request #10470: URL: https://github.com/apache/kafka/pull/10470#discussion_r608748053
########## File path: clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerRecord.java ########## @@ -77,12 +73,41 @@ public ConsumerRecord(String topic, * @param offset The offset of this record in the corresponding Kafka partition * @param timestamp The timestamp of the record. * @param timestampType The timestamp type - * @param checksum The checksum (CRC32) of the full record * @param serializedKeySize The length of the serialized key * @param serializedValueSize The length of the serialized value * @param key The key of the record, if one exists (null is allowed) * @param value The record contents */ + public ConsumerRecord(String topic, + int partition, + long offset, + long timestamp, + TimestampType timestampType, + int serializedKeySize, + int serializedValueSize, + K key, + V value) { + this(topic, partition, offset, timestamp, timestampType, serializedKeySize, serializedValueSize, + key, value, new RecordHeaders()); + } + + /** + * Creates a record to be received from a specified topic and partition (provided for + * compatibility with Kafka 0.10 before the message format supported headers). + * + * @param topic The topic this record is received from + * @param partition The partition of the topic this record is received from + * @param offset The offset of this record in the corresponding Kafka partition + * @param timestamp The timestamp of the record. + * @param timestampType The timestamp type + * @param serializedKeySize The length of the serialized key + * @param serializedValueSize The length of the serialized value + * @param key The key of the record, if one exists (null is allowed) + * @param value The record contents + * + * @deprecated use one of the constructors without a `checksum` parameter Review comment: Yeah, I agree it's annoying. Also, it would be nice to have a constructor like: ```java public ConsumerRecord(String topic, int partition, long offset, long timestamp, TimestampType timestampType, K key, V value) ``` And deprecate: ```java public ConsumerRecord(String topic, int partition, long offset, K key, V value) { ``` But that requires a KIP. For now, I will remove some of the new constructors I added and add a single one: ```java public ConsumerRecord(String topic, int partition, long offset, long timestamp, TimestampType timestampType, int serializedKeySize, int serializedValueSize, K key, V value, Headers headers, Optional<Integer> leaderEpoch) { ``` I'll update the PR with these changes tomorrow. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org