Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

[ballerina]
dependencies-toml-version = "2"
distribution-version = "2201.12.0"
distribution-version = "2201.13.0"

[[package]]
org = "ballerina"
name = "crypto"
version = "2.10.0"
version = "2.10.1"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "time"}
Expand Down Expand Up @@ -46,7 +46,7 @@ modules = [
[[package]]
org = "ballerina"
name = "data.xmldata"
version = "1.5.2"
version = "1.5.3"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.object"}
Expand All @@ -58,7 +58,7 @@ modules = [
[[package]]
org = "ballerina"
name = "file"
version = "1.11.0"
version = "1.12.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "io"},
Expand Down Expand Up @@ -201,7 +201,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "log"
version = "2.14.0"
version = "2.16.1"
dependencies = [
{org = "ballerina", name = "io"},
{org = "ballerina", name = "jballerina.java"},
Expand All @@ -215,15 +215,15 @@ modules = [
[[package]]
org = "ballerina"
name = "observe"
version = "1.5.0"
version = "1.7.0"
dependencies = [
{org = "ballerina", name = "jballerina.java"}
]

[[package]]
org = "ballerina"
name = "os"
version = "1.10.0"
version = "1.10.1"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "io"},
Expand All @@ -233,7 +233,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "task"
version = "2.11.0"
version = "2.11.1"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "time"},
Expand Down
4 changes: 3 additions & 1 deletion ballerina/client_endpoint.bal
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,9 @@ public enum Compression {
# + sftpCompression - Compression algorithms (SFTP only)
# + sftpSshKnownHosts - Path to SSH known_hosts file (SFTP only)
# + proxy - Proxy configuration for SFTP connections (SFTP only)
# + csvFailSafe - Configuration for fail-safe CSV content processing. In the fail-safe mode,
# + csvFailSafe - Configuration for fail-safe CSV content processing. In the fail-safe mode,
# malformed CSV records are skipped and written to a separate file in the current directory
# + retryConfig - Configuration for retry behavior on transient failures. If not specified, no retry is attempted.
public type ClientConfiguration record {|
Protocol protocol = FTP;
string host = "127.0.0.1";
Expand All @@ -466,6 +467,7 @@ public type ClientConfiguration record {|
TransferCompression[] sftpCompression = [NO];
string sftpSshKnownHosts?;
FailSafeOptions csvFailSafe?;
RetryConfig retryConfig?;
|};

isolated function getInputContent(string path, stream<byte[] & readonly, io:Error?>|string|xml|json content,
Expand Down
14 changes: 14 additions & 0 deletions ballerina/commons.bal
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,20 @@ public type SocketConfig record {|
decimal sftpSessionTimeout = 300.0;
|};

# Configuration for retry behavior on transient failures.
# Enables automatic retry with exponential backoff for read operations.
#
# + count - Maximum number of retry attempts (default: 3)
# + interval - Initial wait time in seconds between retries (default: 1.0)
# + backOffFactor - Multiplier for exponential backoff (default: 2.0)
# + maxWaitInterval - Maximum wait time cap in seconds (default: 30.0)
public type RetryConfig record {|
int count = 3;
decimal interval = 1.0;
float backOffFactor = 2.0;
decimal maxWaitInterval = 30.0;
|};

# Internal configuration for content to be written in put and append operations.
#
# + filePath - Path of the file to be created or appended
Expand Down
24 changes: 24 additions & 0 deletions ballerina/error.bal
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,27 @@

# Defines the common error type for the module.
public type Error distinct error;

# Represents an error that occurs when connecting to the FTP/SFTP server.
# This includes network failures, host unreachable, connection refused, etc.
public type ConnectionError distinct Error;

# Represents an error that occurs when a requested file or directory is not found.
public type FileNotFoundError distinct Error;

# Represents an error that occurs when attempting to create a file or directory that already exists.
public type FileAlreadyExistsError distinct Error;

# Represents an error that occurs when FTP/SFTP configuration is invalid.
# This includes invalid port numbers, invalid regex patterns, invalid timeout values, etc.
public type InvalidConfigurationError distinct Error;

# Represents an error that occurs when the FTP/SFTP service is temporarily unavailable.
# This is a transient error indicating the operation may succeed on retry.
# Common causes include: server overload (421), connection issues (425, 426),
# temporary file locks (450), or server-side processing errors (451).
public type ServiceUnavailableError distinct Error;

# Represents an error that occurs when all retry attempts have been exhausted.
# This error wraps the last failure encountered during retry attempts.
public type AllRetryAttemptsFailedError distinct Error;
2 changes: 1 addition & 1 deletion ballerina/tests/advanced_file_selection_test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function testFileAgeFilterRespectsMaxAge() returns error? {
}
},
path: "/home/in/advanced/age",
pollingInterval: 5,
pollingInterval: 2,
fileAgeFilter: {
maxAge: 60
},
Expand Down
Loading
Loading