[BUG] Non-default HTTP retry backoff strategies cannot be selected
- Dominant language
- Java
- Stars
- 8.8k
- Forks
- 3.1k
- Avg merge
- 7d 1h
- Merged PRs (30d)
- 85
Description
### 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`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.