Jason Gustafson created KAFKA-12353:
---------------------------------------
Summary: Improve ClientResponse error handling
Key: KAFKA-12353
URL: https://issues.apache.org/jira/browse/KAFKA-12353
Project: Kafka
Issue Type: Improvement
Reporter: Jason Gustafson
`NetworkClient` exposes a `ClientResponse` object as the result of a sent
request. This is currently handling these cases:
- Response returned successfully
- Socket disconnected before response was read
- Authentication failed while connecting
- Unsupported version error due to client finding no compatible version with
broker
The problem is that there is no type protection to ensure that each of these
cases are handled. We missed some of them initially in
`BrokerToControllerChannelManager` and had to fix them here:
https://github.com/apache/kafka/pull/10157.
It would be useful to consider a refactor which makes it harder to overlook the
exceptional cases. Perhaps an approach similar to
`CompletableFuture.whenComplete` which takes a`BiConsumer<AbstractResponse,
Exception>` would be reasonable. Then we could consolidate the three error
cases above by returning one of the following exceptions:
- DisconnectException
- AuthenticationFailedException
- UnsupportedVersionException
--
This message was sent by Atlassian Jira
(v8.3.4#803005)