
pl.allegro.tech.hermes.client.HermesClientBasicRetryCondition Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hermes-client Show documentation
Show all versions of hermes-client Show documentation
Fast and reliable message broker built on top of Kafka.
package pl.allegro.tech.hermes.client;
import static java.net.HttpURLConnection.HTTP_CLIENT_TIMEOUT;
import java.util.function.Predicate;
public class HermesClientBasicRetryCondition implements Predicate {
@Override
public boolean test(HermesResponse response) {
return response == null
|| (isClientTimeoutOrServerError(response) || isFailedExceptionally(response));
}
private boolean isClientTimeoutOrServerError(HermesResponse response) {
return response.getHttpStatus() == HTTP_CLIENT_TIMEOUT || response.getHttpStatus() / 100 == 5;
}
private boolean isFailedExceptionally(HermesResponse response) {
return response.isFailure() && response.getFailureCause().isPresent();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy