Add retry support#1531
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1531 +/- ##
============================================
- Coverage 80.74% 80.38% -0.36%
- Complexity 816 831 +15
============================================
Files 61 63 +2
Lines 3620 3712 +92
Branches 609 621 +12
============================================
+ Hits 2923 2984 +61
- Misses 437 461 +24
- Partials 260 267 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
c61e229 to
c637310
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds automatic retry support with exponential backoff for FTP client read operations. When configured, the client will automatically retry failed read operations (getBytes, getText, getJson, getXml, getCsv) with configurable retry count, interval, backoff factor, and maximum wait interval.
Changes:
- Added
RetryConfigrecord type with configurable retry parameters (count, interval, backOffFactor, maxWaitInterval) - Implemented retry logic with exponential backoff in
FtpRetryHelperclass - Added new
AllRetryAttemptsFailedErrorerror type for when all retry attempts are exhausted - Wrapped all typed read operations (getBytes, getText, getJson, getXml, getCsv) with retry logic
- Added comprehensive tests covering successful operations with retry config, retry exhaustion scenarios, and configuration validation
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| ballerina/commons.bal | Added RetryConfig record type definition with default values |
| ballerina/client_endpoint.bal | Added optional retryConfig field to ClientConfiguration |
| ballerina/error.bal | Added AllRetryAttemptsFailedError distinct error type |
| ballerina/tests/retry_test.bal | Added comprehensive retry behavior tests including success and failure scenarios |
| ballerina/tests/client_endpoint_test.bal | Updated test expectations to include new retry directory |
| native/src/main/java/io/ballerina/stdlib/ftp/client/FtpClient.java | Wrapped typed read operations with retry logic and stored retry config in native data |
| native/src/main/java/io/ballerina/stdlib/ftp/client/FtpRetryHelper.java | Implemented core retry logic with exponential backoff |
| native/src/main/java/io/ballerina/stdlib/ftp/exception/FtpAllRetryAttemptsFailedException.java | Added exception class for retry exhaustion |
| native/src/main/java/io/ballerina/stdlib/ftp/util/FtpConstants.java | Added retry-related constants |
| native/src/main/java/io/ballerina/stdlib/ftp/util/FtpUtil.java | Added AllRetryAttemptsFailedError enum value |
| test-utils/src/main/java/io/ballerina/stdlib/ftp/testutils/mockServerUtils/MockFtpServer.java | Added retry test directory and file to mock server |
| docs/spec/spec.md | Documented retry configuration and usage examples |
| changelog.md | Added changelog entry for retry feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
native/src/main/java/io/ballerina/stdlib/ftp/client/FtpRetryHelper.java
Outdated
Show resolved
Hide resolved
native/src/main/java/io/ballerina/stdlib/ftp/exception/FtpAllRetryAttemptsFailedException.java
Outdated
Show resolved
Hide resolved
native/src/main/java/io/ballerina/stdlib/ftp/client/FtpRetryHelper.java
Outdated
Show resolved
Hide resolved
native/src/main/java/io/ballerina/stdlib/ftp/client/FtpRetryHelper.java
Outdated
Show resolved
Hide resolved
native/src/main/java/io/ballerina/stdlib/ftp/client/FtpRetryHelper.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
native/src/main/java/io/ballerina/stdlib/ftp/client/FtpRetryHelper.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
native/src/main/java/io/ballerina/stdlib/ftp/client/FtpRetryHelper.java
Outdated
Show resolved
Hide resolved
native/src/main/java/io/ballerina/stdlib/ftp/client/FtpRetryHelper.java
Outdated
Show resolved
Hide resolved
native/src/main/java/io/ballerina/stdlib/ftp/client/FtpClient.java
Outdated
Show resolved
Hide resolved
|



Purpose
Fixes ballerina-platform/ballerina-library#8585
Examples
Checklist