Retry Mechanism
Requests sent to backend APIs may fail due to timeouts, connection errors, or temporary errors. The Retry mechanism ensures that such temporary errors are automatically retried.Retry Parameters
Retry Flow
The retry mechanism is triggered in the following situations:- Timeout: When connection timeout or read timeout occurs
- Error Codes: When HTTP error codes (4xx, 5xx) are returned from the backend
- Connection Errors: When connection errors such as UnknownHostException, MalformedURLException occur
-
Initial request is sent and result is checked:
- If request is successful: Operation is completed
- If request fails: Retry mechanism is activated
-
Retry mechanism:
- If retry count is 0: Error is returned
- If retry count is greater than 0: Retry loop is entered
-
Retry loop (from i = 1 to retry count):
- If retry delay is active: Specified duration is waited
- Request is retried
- If request is successful: Operation is completed
- If request fails and i < retry count: i is incremented and loop continues
- If request fails and i = retry count: Failover mechanism is activated
Failover Mechanism
The Failover mechanism automatically redirects requests to other backend addresses when one backend address fails.Failover Logic
The failover mechanism works with a simple and clear logic:- Initial Request: Sent to PRIMARY addresses (with load balancing)
- Failure Condition: If the initial request fails and
failoverOnlyEnabled=true - Failover Addresses: Requests are sent sequentially to addresses of type FAILOVER
- Failover Retry: Each failover address is tried
failoverRetryCounttimes
Failover Flow
The failover mechanism works as follows:-
Request is sent to PRIMARY backend and retry count attempts are made:
- If request is successful: Operation is completed
- If all attempts fail: Failover check is performed
-
Failover check:
- If
failoverOnlyEnabled = falseornull: Error is returned - If
failoverOnlyEnabled = true: FAILOVER addresses are used
- If
-
FAILOVER addresses (tried sequentially):
- First failover address is selected
- Failover retry count attempts are made
- If request is successful: Operation is completed
- If request fails: Next failover address is tried
-
Until all failover addresses are tried:
- Each failover address is tried failover retry count times
- First successful address is used and operation is completed
- If all failover addresses fail: Error is returned
Address Types
Active Health Check
The Active Health Check mechanism periodically checks the health status of backends and works integrated with circuit breaker to provide automatic failover.Health Check Parameters
If Health Path is empty or null, health check is not performed for that backend and backend health status is not monitored.
Health Check → Circuit Breaker Coordination
The health check mechanism works coordinated with circuit breaker to automatically disable and re-enable backends based on their health status.Health Check Lifecycle Management
When an API Proxy is deployed, updated, or undeployed, health check records are automatically managed:- Deploy/Update: New backends are added, removed backends are deleted, unchanged backends’ config is updated (health status preserved)
- Undeploy: All backends’ health check records are cleaned up
Circuit Breaker Integration
Circuit breaker works integrated with the health check mechanism to automatically activate or deactivate based on backend health status.Circuit Breaker States
Circuit Breaker Parameters
Circuit Breaker and Health Check Coordination
The health check mechanism automatically manages the circuit breaker:- Backend Unhealthy: When health check fail threshold is exceeded, circuit breaker automatically transitions to OPEN state
- Backend Healthy: When health check pass threshold is exceeded, circuit breaker automatically transitions to CLOSED state
Circuit breaker works coordinated with health check. If health check is not active, circuit breaker only works based on errors in actual requests.
Rollback Mechanism
During retry and failover operations, a rollback mechanism is used to preserve the message context state.Rollback Logic
The rollback mechanism works with a simple logic:- Initial Request (Primary): No rollback is performed
- Retry Requests (i > 1): Rollback is performed before each retry
- Failover Requests: Rollback is performed for each failover address (because we’re coming after the previous address)
Related Topics
- Load Balancing - Load distribution among backend addresses
- Canary Release - Canary release mechanism integrated with health check
- Circuit Breaker - Detailed circuit breaker configuration

