lianetm commented on code in PR #15525: URL: https://github.com/apache/kafka/pull/15525#discussion_r1539933946
########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/events/ListOffsetsEvent.java: ########## @@ -25,22 +25,15 @@ import java.util.Map; /** - * Event for retrieving partition offsets by performing a + * Application Event for retrieving partition offsets by performing a * {@link org.apache.kafka.common.requests.ListOffsetsRequest ListOffsetsRequest}. - * This event is created with a map of {@link TopicPartition} and target timestamps to search - * offsets for. It is completed with the map of {@link TopicPartition} and - * {@link OffsetAndTimestamp} found (offset of the first message whose timestamp is greater than - * or equals to the target timestamp) */ -public class ListOffsetsEvent extends CompletableApplicationEvent<Map<TopicPartition, OffsetAndTimestamp>> { - +public class ListOffsetsEvent extends CompletableApplicationEvent<Map<TopicPartition, Long>> { Review Comment: KInd of a general comment looking for simplification: couldn't we just have an internal new class `OffsetAndTimestampInternal` (better named), that allows negatives and knows how to build an `OffsetAndTimestamp`? Seems to solve the problem we have, without having to split the `ListOffsets` into 2 events, with separate paths for beginning/endOffsets and offsetsForTimes, where in reality they have everything in common, except for the object we use to encapsulate the result (same result). These new splitted path leak down to the OffsetsManager event, when in reality, at the request/response level the manager is responsible for, everything is the same for both paths. With this approach the change would only be at the API level, on the consumer, where the result of the event would build the map with Longs for the beginning/end, or the map with OffsetAndTimestamp for the offsetsForTimes (data is the same, we just need to change how we return it). -- 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. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org