dev.fitko.fitconnect.api.config.defaults.RetryableStatusCodes Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of client Show documentation
Show all versions of client Show documentation
Library that provides client access to the FIT-Connect api-endpoints for sending, subscribing and
routing
The newest version!
package dev.fitko.fitconnect.api.config.defaults;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* HTTP status codes that are eligible for retries
*/
public enum RetryableStatusCodes {
// Client Side
REQUEST_TIMEOUT(408),
TOO_MANY_REQUESTS(429),
// Server Side
INTERNAL_SERVER_ERROR(500),
BAD_GATEWAY(502),
SERVICE_UNAVAILABLE(503),
GATEWAY_TIMEOUT(504);
private final int status;
RetryableStatusCodes(int status){
this.status = status;
}
public int getStatus() {
return status;
}
public static List getDefaultCodes(){
return Arrays.stream(values()).map(RetryableStatusCodes::getStatus).collect(Collectors.toList());
}
}