Spring-cloud-gateway: Document setting specific series to null with status codes in retry filter.

Created on 21 Jan 2020  路  6Comments  路  Source: spring-cloud/spring-cloud-gateway

Describe the bug
In our production we want to use retry filter for some of our routes. We need to retry for specific statuses 502 or 503 for example. And if we have in response a status that we didn't specify from 5xx series (like 500), it will retry anyway. This is because 5xx series is default in RetryConfig:

private List<Series> series = toList(Series.SERVER_ERROR);

And because if the code is not retryable code the factory tries series:

if (!retryableStatusCode && statusCode != null) {
    retryableStatusCode = retryConfig.getSeries().stream()
    .anyMatch(series -> statusCode.series().equals(series));
}

Moreover, if we specified 400 code (for example) in Retry config the filter will also retry on 5xx codes.

I found a solution by specifing series value as null, but it looks like duct tape and temporary solution.

Sample
Here is the sample repository

documentation

All 6 comments

Doesn't specifying null make sense? You need to tell the config to not include any series. Do you have a better solution in mind?

@ryanjbaxter I think not specifing the series at all makes more sense because it implies that you don't need series to be checked. Yes, I have a solution, check readme of my sample

We are being opinionated here. I think series, in general, makes more sense as a default. If you want specific codes, set the series to null.

We are being opinionated here. I think series, in general, makes more sense as a default. If you want specific codes, set the series to null.

Can you please add a line in documentation of the filter about that? This is really not obvious solution

Having a specific 400 error like 401 and the 500 series is still valid.

Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bijukunjummen picture bijukunjummen  路  3Comments

pravinkumarb84 picture pravinkumarb84  路  7Comments

larva2333 picture larva2333  路  6Comments

vborcea picture vborcea  路  6Comments

maoyunfei picture maoyunfei  路  3Comments