spring-cloud / spring-cloud/spring-cloud-gateway

RetryGatewayFilterFactory should support custom exchange attribute

Open
#2,683 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.