Aias00 opened a new issue, #6464:
URL: https://github.com/apache/shenyu/issues/6464
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Current Behavior
The HTTP client plugin appears to support multiple retry backoff strategies
(`default`, `fixed`, `exponential`, `custom`), but current master cannot select
any non-default strategy through built-in code.
`AbstractHttpClientPlugin` reads the strategy type from an exchange
attribute:
```java
String retryStrategyType = (String) Optional
.ofNullable(exchange.getAttribute(Constants.HTTP_RETRY_BACK_OFF_SPEC))
.orElse(HttpRetryBackoffSpecEnum.getDefault());
```
However `Constants.HTTP_RETRY_BACK_OFF_SPEC` is currently defined as the
literal string `"default"`, so it is used as the exchange attribute key. I
could not find any current code path that writes an exchange attribute with
that key. As a result, the code always falls back to
`HttpRetryBackoffSpecEnum.getDefault()` and the `fixed` / `exponential` /
`custom` branches are effectively unreachable from built-in configuration.
There is also a hard failure if anything does force the `custom` branch:
`CustomRetryStrategy#execute(...)` currently returns `null`, and
`AbstractHttpClientPlugin` immediately calls methods on the returned `Mono`,
causing a `NullPointerException`.
### Expected Behavior
Non-default retry backoff strategies should either be configurable and
stored in the exchange under a real attribute key, or the dead strategy
branches should be removed/disabled until they are supported.
The `custom` strategy should not return `null`; if it is unsupported, it
should fail explicitly or be excluded from selection.
### Steps To Reproduce
1. Configure an HTTP route with retry enabled.
2. Try to select a non-default backoff strategy such as `fixed` or
`exponential` through the available rule/configuration path.
3. The HTTP client still uses the default strategy because no built-in code
writes `exchange.setAttribute(Constants.HTTP_RETRY_BACK_OFF_SPEC, "fixed")` or
similar.
4. If an extension manually writes the attribute value `custom`,
`CustomRetryStrategy#execute(...)` returns `null` and the request fails with
NPE.
### Environment
```markdown
ShenYu version(s): current master
```
### Debug logs
_No response_
### Anything else?
Relevant current-master files:
-
`shenyu-common/src/main/java/org/apache/shenyu/common/constant/Constants.java`
-
`shenyu-plugin/shenyu-plugin-httpclient/src/main/java/org/apache/shenyu/plugin/httpclient/AbstractHttpClientPlugin.java`
-
`shenyu-plugin/shenyu-plugin-httpclient/src/main/java/org/apache/shenyu/plugin/httpclient/CustomRetryStrategy.java`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]