The OffsetsForLeaderEpochClient class is used for making asynchronous requests to the OffsetsForLeaderEpoch API. It encapsulates the logic for:
- preparing the requests
- sending them over the network using the network client
- handling the response
The new KafkaConsumer implementation, based on a new threading model, requires the same logic for preparing the requests and handling the responses, with different behaviour for how the request is actually sent.
This task includes refactoring OffsetsForLeaderEpochClient by extracting out the logic for preparing the requests and handling the responses. No changes in the existing logic, just making the functionality available to be reused.