spring-cloud / spring-cloud/spring-cloud-gateway
RetryGatewayFilterFactory should support custom exchange attribute
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.9k
- Forks
- 3.5k
- Avg merge
- 20h 57m
- Merged PRs (30d)
- 8
Description
Describe the bug
The current implementation uses RETRY_ITERATION_KEY="retry_iteration" as the constant attribute name for tracking the iteration in the exchange. This prevents leveraging different retry strategies for different cases - for example, for IOExceptions we want to retry up to 3 times, but for authentication issues using cached credentials we want to clear the cache, and try again 1 time.
There should be a default name, but it should be configurable which name to actually use.
It may be possible to work-around this by introducing intermediate filters which "copy" that attribute to some other attribute and vice-versa as part of the outgoing and returning chains. Alternatively, a decorator could be applied to the exchange in a preceding filter such that the RETRY_ITERATION_KEY is mapped to some other attribute key.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading RetryGatewayFilterFactory and how it stores RETRY_ITERATION_KEY on the exchange. Trace the retry configuration and related tests, then define what a configurable attribute name with the existing default should affect. Done means separate retry strategies can use distinct exchange attributes without breaking the default behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100