Created
July 24, 2015 21:27
-
-
Save mac01021/b0780377077758b663ab to your computer and use it in GitHub Desktop.
Simple connection error code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FetchRequest req = new FetchRequestBuilder() | |
| .clientId(clientId) | |
| .addFetch(topic, partition, offset, fetchSize) | |
| .minBytes(1) | |
| .maxWait(250) | |
| .build(); | |
| FetchResponse resp = underlying.fetch(req); | |
| if(resp.hasError()) { | |
| int code = resp.errorCode(topic, partition); | |
| if (code == 9) { | |
| logger.warn("Fetch response contained error code: {}", resp.errorCode(topic, partition)); | |
| } else { | |
| throw new RuntimeException(String.format("Fetch response contained error code %d", code)); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment