You can use the retry
policy to replay requests when experiencing backend connection issues or if the response meets a given condition.
If the retry takes too long, relative to the timeout
value, the request stops and returns status code 502
.
Note
|
To replay a request with a payload, the gateway stores it in memory. We recommend you avoid applying it to requests with a large payload. |
Property | Required | Description | Default | Example |
---|---|---|---|---|
condition |
X |
Condition to test to determine whether or not to retry the request (supports Expression Language) |
- |
{#response.status > 500} |
maxRetries |
X |
Number of retries before failing (502 - Bad Gateway) |
1 |
- |
delay |
- |
Time between each attempt |
0 |
- |
timeout |
X |
Time after which an operation is considered a failure |
1000 |
- |
lastResponse |
- |
Returns the last attempt response, even if it failed regarding the configured condition. In timeout case, |
false |
- |
{
"retry": {
"condition": "{#response.status > 500}",
"maxRetries": 3,
"timeout": 1000
}
}