This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 340d827813e4 CAMEL-27915: camel-mina-sftp: readBufferSize, 
writeBufferSize and bulkRequests have no effect (#31241)
340d827813e4 is described below

commit 340d827813e481aa1c110cb7d3c2221b9498843e
Author: Guillaume Nodet <[email protected]>
AuthorDate: Wed Dec 2 23:02:20 2026 +0100

    CAMEL-27915: camel-mina-sftp: readBufferSize, writeBufferSize and 
bulkRequests have no effect (#31241)
    
    MinaSftpOperations set the buffer sizes as SftpModuleProperties session 
properties, which only the NIO2 file system
    provider reads, not the SftpClient.read()/write() stream methods the 
component uses. Every transfer therefore used
    MINA SSHD's default chunk size.
    
    The effective read and write buffer sizes are now passed to the four 
SftpClient.read()/write() call sites. 0 (the
    default) keeps MINA SSHD's own default. Values 1-255 are rejected at 
connect time, and values above 129536 are capped.
    A unit test covers the configuration and an embedded-server IT checks the 
sizes on the wire. The 4.25 upgrade guide
    describes the change.
    
    Co-authored-by: Claude Sonnet 4.6 <[email protected]>
---
 .../apache/camel/catalog/components/mina-sftp.json |   4 +-
 .../camel/catalog/docs/mina-sftp-component.adoc    |   6 +-
 .../component/file/remote/mina/mina-sftp.json      |   4 +-
 .../src/main/docs/mina-sftp-component.adoc         |   6 +-
 .../file/remote/mina/MinaSftpConfiguration.java    |  16 +-
 .../file/remote/mina/MinaSftpOperations.java       |  62 ++++--
 .../mina/MinaSftpOperationsBufferSizeTest.java     | 244 +++++++++++++++++++++
 .../remote/mina/sftp/SftpBufferSizeOnWireIT.java   | 155 +++++++++++++
 .../ROOT/pages/camel-4x-upgrade-guide-4_25.adoc    |  18 ++
 .../dsl/MinaSftpEndpointBuilderFactory.java        |  96 +++-----
 10 files changed, 516 insertions(+), 95 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/mina-sftp.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/mina-sftp.json
index cbf6a3caef98..1f5ee4dfa2a0 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/mina-sftp.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/mina-sftp.json
@@ -113,7 +113,7 @@
     "filenameEncoding": { "index": 55, "kind": "parameter", "displayName": 
"Filename Encoding", "group": "advanced", "label": "advanced", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.file.remote.mina.MinaSftpConfiguration", 
"configurationField": "configuration", "description": "The character encoding 
of the file names on the server, such as UTF-8 (the default)." },
     "jschLoggingLevel": { "index": 56, "kind": "parameter", "displayName": 
"Jsch Logging Level", "group": "advanced", "label": "advanced", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": true, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.file.remote.mina.MinaSftpConfiguration", 
"configurationField": "configuration", "description": "Deprecated: 
JSch-specific parameter, ignored by mina-sftp. Configure logging via  [...]
     "maximumReconnectAttempts": { "index": 57, "kind": "parameter", 
"displayName": "Maximum Reconnect Attempts", "group": "advanced", "label": 
"advanced", "required": false, "type": "integer", "javaType": "int", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
maximum number of attempts to connect to the remote server each time a 
connection is needed, reconnectDelay apart. Default is 3. 0 or less means a 
single attempt. A login that the server rejects is not  [...]
-    "readBufferSize": { "index": 58, "kind": "parameter", "displayName": "Read 
Buffer Size", "group": "advanced", "label": "advanced", "required": false, 
"type": "integer", "javaType": "java.lang.Integer", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.file.remote.mina.MinaSftpConfiguration", 
"configurationField": "configuration", "description": "The read buffer size in 
bytes. Camel sets it as the Apache MINA SSHD session prope [...]
+    "readBufferSize": { "index": 58, "kind": "parameter", "displayName": "Read 
Buffer Size", "group": "advanced", "label": "advanced", "required": false, 
"type": "integer", "javaType": "java.lang.Integer", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.file.remote.mina.MinaSftpConfiguration", 
"configurationField": "configuration", "description": "Size in bytes of each 
SFTP read request sent to the server. Must be 0 (MINA SSHD d [...]
     "reconnectDelay": { "index": 59, "kind": "parameter", "displayName": 
"Reconnect Delay", "group": "advanced", "label": "advanced", "required": false, 
"type": "duration", "javaType": "long", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": "1000", "description": "The delay in 
milliseconds between two attempts to connect to the remote server." },
     "serverAliveCountMax": { "index": 60, "kind": "parameter", "displayName": 
"Server Alive Count Max", "group": "advanced", "label": "advanced", "required": 
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": 1, "configurationClass": 
"org.apache.camel.component.file.remote.mina.MinaSftpConfiguration", 
"configurationField": "configuration", "description": "The number of keep-alive 
messages that may be sent without receivi [...]
     "serverAliveInterval": { "index": 61, "kind": "parameter", "displayName": 
"Server Alive Interval", "group": "advanced", "label": "advanced", "required": 
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.file.remote.mina.MinaSftpConfiguration", 
"configurationField": "configuration", "description": "The interval in 
milliseconds for sending keep-alive messages to the server. 0 (the def [...]
@@ -121,7 +121,7 @@
     "soTimeout": { "index": 63, "kind": "parameter", "displayName": "So 
Timeout", "group": "advanced", "label": "advanced", "required": false, "type": 
"duration", "javaType": "int", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": "300000", "configurationClass": 
"org.apache.camel.component.file.remote.mina.MinaSftpConfiguration", 
"configurationField": "configuration", "description": "The socket timeout 
(SO_TIMEOUT) in milliseconds, so that a connection whose serv [...]
     "stepwise": { "index": 64, "kind": "parameter", "displayName": "Stepwise", 
"group": "advanced", "label": "advanced", "required": false, "type": "boolean", 
"javaType": "boolean", "deprecated": false, "autowired": false, "secret": 
false, "defaultValue": true, "configurationClass": 
"org.apache.camel.component.file.remote.mina.MinaSftpConfiguration", 
"configurationField": "configuration", "description": "Whether to change 
directory one level at a time when traversing directories to downl [...]
     "timeout": { "index": 65, "kind": "parameter", "displayName": "Timeout", 
"group": "advanced", "label": "advanced", "required": false, "type": 
"duration", "javaType": "int", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": "30000", "configurationClass": 
"org.apache.camel.component.file.remote.mina.MinaSftpConfiguration", 
"configurationField": "configuration", "description": "The data timeout in 
milliseconds. For ftp and ftps, it is the read timeout of the data [...]
-    "writeBufferSize": { "index": 66, "kind": "parameter", "displayName": 
"Write Buffer Size", "group": "advanced", "label": "advanced", "required": 
false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.file.remote.mina.MinaSftpConfiguration", 
"configurationField": "configuration", "description": "The write buffer size in 
bytes. Camel sets it as the Apache MINA SSHD session pr [...]
+    "writeBufferSize": { "index": 66, "kind": "parameter", "displayName": 
"Write Buffer Size", "group": "advanced", "label": "advanced", "required": 
false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.file.remote.mina.MinaSftpConfiguration", 
"configurationField": "configuration", "description": "Size in bytes of each 
SFTP write request sent to the server. Must be 0 (MINA SSH [...]
     "antExclude": { "index": 67, "kind": "parameter", "displayName": "Ant 
Exclude", "group": "filter", "label": "consumer,filter", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "Excludes the files whose 
path, relative to the starting directory, matches one of these Ant style 
patterns, such as **\/*.bak. Separate several patterns with a comma. Takes 
precedence over antInclude." },
     "antFilterCaseSensitive": { "index": 68, "kind": "parameter", 
"displayName": "Ant Filter Case Sensitive", "group": "filter", "label": 
"consumer,filter", "required": false, "type": "boolean", "javaType": "boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true, 
"description": "Whether the antInclude and antExclude patterns are matched case 
sensitive." },
     "antInclude": { "index": 69, "kind": "parameter", "displayName": "Ant 
Include", "group": "filter", "label": "consumer,filter", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "Includes only the files 
whose path, relative to the starting directory, matches one of these Ant style 
patterns, such as **\/*.txt. Separate several patterns with a comma." },
diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/mina-sftp-component.adoc
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/mina-sftp-component.adoc
index f0d0d4f7d9d9..abe2eef67430 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/mina-sftp-component.adoc
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/mina-sftp-component.adoc
@@ -624,14 +624,14 @@ 
from("mina-sftp://user@host/path?password=secret&readBufferSize=65536&writeBuffe
 
 | `readBufferSize`
 | MINA default
-| Buffer size in bytes for reading data from SFTP connections
+| Size in bytes of each SFTP read request sent to the server. Must be 0 (MINA 
SSHD default) or at least 256. Values above 129536 are capped.
 
 | `writeBufferSize`
 | MINA default
-| Buffer size in bytes for writing data to SFTP connections
+| Size in bytes of each SFTP write request sent to the server. Must be 0 (MINA 
SSHD default) or at least 256. Values above 129536 are capped.
 |===
 
-IMPORTANT: The maximum recommended buffer size is `126976` bytes (~124KB). 
Larger values may cause data corruption in Apache MINA SSHD.
+IMPORTANT: The maximum effective buffer size is `129536` bytes (~126.5 KB). 
Values above this limit are capped silently, as larger SFTP data frames can 
cause data corruption in Apache MINA SSHD (see SSHD-1069). Values in the range 
1–255 are rejected with an exception at connect time.
 
 The deprecated `bulkRequests` parameter is still accepted for backward 
compatibility but new configurations should use `readBufferSize` and 
`writeBufferSize` directly.
 
diff --git 
a/components/camel-mina-sftp/src/generated/resources/META-INF/org/apache/camel/component/file/remote/mina/mina-sftp.json
 
b/components/camel-mina-sftp/src/generated/resources/META-INF/org/apache/camel/component/file/remote/mina/mina-sftp.json
index cbf6a3caef98..1f5ee4dfa2a0 100644
--- 
a/components/camel-mina-sftp/src/generated/resources/META-INF/org/apache/camel/component/file/remote/mina/mina-sftp.json
+++ 
b/components/camel-mina-sftp/src/generated/resources/META-INF/org/apache/camel/component/file/remote/mina/mina-sftp.json
@@ -113,7 +113,7 @@
     "filenameEncoding": { "index": 55, "kind": "parameter", "displayName": 
"Filename Encoding", "group": "advanced", "label": "advanced", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.file.remote.mina.MinaSftpConfiguration", 
"configurationField": "configuration", "description": "The character encoding 
of the file names on the server, such as UTF-8 (the default)." },
     "jschLoggingLevel": { "index": 56, "kind": "parameter", "displayName": 
"Jsch Logging Level", "group": "advanced", "label": "advanced", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": true, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.file.remote.mina.MinaSftpConfiguration", 
"configurationField": "configuration", "description": "Deprecated: 
JSch-specific parameter, ignored by mina-sftp. Configure logging via  [...]
     "maximumReconnectAttempts": { "index": 57, "kind": "parameter", 
"displayName": "Maximum Reconnect Attempts", "group": "advanced", "label": 
"advanced", "required": false, "type": "integer", "javaType": "int", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
maximum number of attempts to connect to the remote server each time a 
connection is needed, reconnectDelay apart. Default is 3. 0 or less means a 
single attempt. A login that the server rejects is not  [...]
-    "readBufferSize": { "index": 58, "kind": "parameter", "displayName": "Read 
Buffer Size", "group": "advanced", "label": "advanced", "required": false, 
"type": "integer", "javaType": "java.lang.Integer", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.file.remote.mina.MinaSftpConfiguration", 
"configurationField": "configuration", "description": "The read buffer size in 
bytes. Camel sets it as the Apache MINA SSHD session prope [...]
+    "readBufferSize": { "index": 58, "kind": "parameter", "displayName": "Read 
Buffer Size", "group": "advanced", "label": "advanced", "required": false, 
"type": "integer", "javaType": "java.lang.Integer", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.file.remote.mina.MinaSftpConfiguration", 
"configurationField": "configuration", "description": "Size in bytes of each 
SFTP read request sent to the server. Must be 0 (MINA SSHD d [...]
     "reconnectDelay": { "index": 59, "kind": "parameter", "displayName": 
"Reconnect Delay", "group": "advanced", "label": "advanced", "required": false, 
"type": "duration", "javaType": "long", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": "1000", "description": "The delay in 
milliseconds between two attempts to connect to the remote server." },
     "serverAliveCountMax": { "index": 60, "kind": "parameter", "displayName": 
"Server Alive Count Max", "group": "advanced", "label": "advanced", "required": 
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": 1, "configurationClass": 
"org.apache.camel.component.file.remote.mina.MinaSftpConfiguration", 
"configurationField": "configuration", "description": "The number of keep-alive 
messages that may be sent without receivi [...]
     "serverAliveInterval": { "index": 61, "kind": "parameter", "displayName": 
"Server Alive Interval", "group": "advanced", "label": "advanced", "required": 
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.file.remote.mina.MinaSftpConfiguration", 
"configurationField": "configuration", "description": "The interval in 
milliseconds for sending keep-alive messages to the server. 0 (the def [...]
@@ -121,7 +121,7 @@
     "soTimeout": { "index": 63, "kind": "parameter", "displayName": "So 
Timeout", "group": "advanced", "label": "advanced", "required": false, "type": 
"duration", "javaType": "int", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": "300000", "configurationClass": 
"org.apache.camel.component.file.remote.mina.MinaSftpConfiguration", 
"configurationField": "configuration", "description": "The socket timeout 
(SO_TIMEOUT) in milliseconds, so that a connection whose serv [...]
     "stepwise": { "index": 64, "kind": "parameter", "displayName": "Stepwise", 
"group": "advanced", "label": "advanced", "required": false, "type": "boolean", 
"javaType": "boolean", "deprecated": false, "autowired": false, "secret": 
false, "defaultValue": true, "configurationClass": 
"org.apache.camel.component.file.remote.mina.MinaSftpConfiguration", 
"configurationField": "configuration", "description": "Whether to change 
directory one level at a time when traversing directories to downl [...]
     "timeout": { "index": 65, "kind": "parameter", "displayName": "Timeout", 
"group": "advanced", "label": "advanced", "required": false, "type": 
"duration", "javaType": "int", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": "30000", "configurationClass": 
"org.apache.camel.component.file.remote.mina.MinaSftpConfiguration", 
"configurationField": "configuration", "description": "The data timeout in 
milliseconds. For ftp and ftps, it is the read timeout of the data [...]
-    "writeBufferSize": { "index": 66, "kind": "parameter", "displayName": 
"Write Buffer Size", "group": "advanced", "label": "advanced", "required": 
false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.file.remote.mina.MinaSftpConfiguration", 
"configurationField": "configuration", "description": "The write buffer size in 
bytes. Camel sets it as the Apache MINA SSHD session pr [...]
+    "writeBufferSize": { "index": 66, "kind": "parameter", "displayName": 
"Write Buffer Size", "group": "advanced", "label": "advanced", "required": 
false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.file.remote.mina.MinaSftpConfiguration", 
"configurationField": "configuration", "description": "Size in bytes of each 
SFTP write request sent to the server. Must be 0 (MINA SSH [...]
     "antExclude": { "index": 67, "kind": "parameter", "displayName": "Ant 
Exclude", "group": "filter", "label": "consumer,filter", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "Excludes the files whose 
path, relative to the starting directory, matches one of these Ant style 
patterns, such as **\/*.bak. Separate several patterns with a comma. Takes 
precedence over antInclude." },
     "antFilterCaseSensitive": { "index": 68, "kind": "parameter", 
"displayName": "Ant Filter Case Sensitive", "group": "filter", "label": 
"consumer,filter", "required": false, "type": "boolean", "javaType": "boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true, 
"description": "Whether the antInclude and antExclude patterns are matched case 
sensitive." },
     "antInclude": { "index": 69, "kind": "parameter", "displayName": "Ant 
Include", "group": "filter", "label": "consumer,filter", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "Includes only the files 
whose path, relative to the starting directory, matches one of these Ant style 
patterns, such as **\/*.txt. Separate several patterns with a comma." },
diff --git a/components/camel-mina-sftp/src/main/docs/mina-sftp-component.adoc 
b/components/camel-mina-sftp/src/main/docs/mina-sftp-component.adoc
index f0d0d4f7d9d9..abe2eef67430 100644
--- a/components/camel-mina-sftp/src/main/docs/mina-sftp-component.adoc
+++ b/components/camel-mina-sftp/src/main/docs/mina-sftp-component.adoc
@@ -624,14 +624,14 @@ 
from("mina-sftp://user@host/path?password=secret&readBufferSize=65536&writeBuffe
 
 | `readBufferSize`
 | MINA default
-| Buffer size in bytes for reading data from SFTP connections
+| Size in bytes of each SFTP read request sent to the server. Must be 0 (MINA 
SSHD default) or at least 256. Values above 129536 are capped.
 
 | `writeBufferSize`
 | MINA default
-| Buffer size in bytes for writing data to SFTP connections
+| Size in bytes of each SFTP write request sent to the server. Must be 0 (MINA 
SSHD default) or at least 256. Values above 129536 are capped.
 |===
 
-IMPORTANT: The maximum recommended buffer size is `126976` bytes (~124KB). 
Larger values may cause data corruption in Apache MINA SSHD.
+IMPORTANT: The maximum effective buffer size is `129536` bytes (~126.5 KB). 
Values above this limit are capped silently, as larger SFTP data frames can 
cause data corruption in Apache MINA SSHD (see SSHD-1069). Values in the range 
1–255 are rejected with an exception at connect time.
 
 The deprecated `bulkRequests` parameter is still accepted for backward 
compatibility but new configurations should use `readBufferSize` and 
`writeBufferSize` directly.
 
diff --git 
a/components/camel-mina-sftp/src/main/java/org/apache/camel/component/file/remote/mina/MinaSftpConfiguration.java
 
b/components/camel-mina-sftp/src/main/java/org/apache/camel/component/file/remote/mina/MinaSftpConfiguration.java
index d4b7791faae9..fd7d3fb903e6 100644
--- 
a/components/camel-mina-sftp/src/main/java/org/apache/camel/component/file/remote/mina/MinaSftpConfiguration.java
+++ 
b/components/camel-mina-sftp/src/main/java/org/apache/camel/component/file/remote/mina/MinaSftpConfiguration.java
@@ -64,16 +64,14 @@ public class MinaSftpConfiguration extends 
BaseSftpConfiguration {
 
     // MINA-specific: buffer sizes
     @UriParam(label = "advanced",
-              description = "The read buffer size in bytes. Camel sets it as 
the Apache MINA SSHD session property"
-                            + " sftp-fs-read-buffer-size, which only the SFTP 
file system of Apache MINA SSHD reads, not the"
-                            + " SFTP client that this component uses. So this 
option currently has no effect: files are read"
-                            + " in chunks of the SSH channel packet size.")
+              description = "Size in bytes of each SFTP read request sent to 
the server."
+                            + " Must be 0 (MINA SSHD default) or at least 256. 
Values above 129536 are capped."
+                            + " When not set, Apache MINA SSHD uses its own 
default.")
     private Integer readBufferSize;
     @UriParam(label = "advanced",
-              description = "The write buffer size in bytes. Camel sets it as 
the Apache MINA SSHD session property"
-                            + " sftp-fs-write-buffer-size, which only the SFTP 
file system of Apache MINA SSHD reads, not the"
-                            + " SFTP client that this component uses. So this 
option currently has no effect: files are written"
-                            + " in chunks of the SSH channel packet size.")
+              description = "Size in bytes of each SFTP write request sent to 
the server."
+                            + " Must be 0 (MINA SSHD default) or at least 256. 
Values above 129536 are capped."
+                            + " When not set, Apache MINA SSHD uses its own 
default.")
     private Integer writeBufferSize;
 
     public MinaSftpConfiguration() {
@@ -155,7 +153,7 @@ public class MinaSftpConfiguration extends 
BaseSftpConfiguration {
      *
      * @deprecated Use {@link #setReadBufferSize(Integer)} and {@link 
#setWriteBufferSize(Integer)} instead. Each bulk
      *             request corresponds to approximately 32KB of buffer. For 
example, bulkRequests=4 is equivalent to
-     *             readBufferSize=131072 and writeBufferSize=131072.
+     *             readBufferSize=129536 and writeBufferSize=129536 (capped at 
the internal MAX_BUFFER_SIZE).
      */
     @Override
     @Deprecated(since = "4.18")
diff --git 
a/components/camel-mina-sftp/src/main/java/org/apache/camel/component/file/remote/mina/MinaSftpOperations.java
 
b/components/camel-mina-sftp/src/main/java/org/apache/camel/component/file/remote/mina/MinaSftpOperations.java
index df53dc701590..0f0fd3484cab 100644
--- 
a/components/camel-mina-sftp/src/main/java/org/apache/camel/component/file/remote/mina/MinaSftpOperations.java
+++ 
b/components/camel-mina-sftp/src/main/java/org/apache/camel/component/file/remote/mina/MinaSftpOperations.java
@@ -80,7 +80,6 @@ import org.apache.sshd.common.kex.KeyExchangeFactory;
 import org.apache.sshd.common.signature.BuiltinSignatures;
 import org.apache.sshd.common.signature.Signature;
 import org.apache.sshd.core.CoreModuleProperties;
-import org.apache.sshd.sftp.SftpModuleProperties;
 import org.apache.sshd.sftp.client.SftpClient;
 import org.apache.sshd.sftp.client.SftpClient.CloseableHandle;
 import org.apache.sshd.sftp.client.SftpClient.DirEntry;
@@ -127,6 +126,12 @@ public class MinaSftpOperations
     private final Lock lock = new ReentrantLock();
     // whether connect, with its reconnect attempts, holds the lock
     private volatile boolean connecting;
+    // Effective buffer sizes passed directly to SftpClient.read()/write() 
calls.
+    // SftpModuleProperties on the session are only consulted by 
SftpFileSystemProvider,
+    // not by SftpClient.read()/write() — so we capture them here and pass 
them explicitly.
+    private int effectiveReadBufferSize;
+    private int effectiveWriteBufferSize;
+
     /**
      * Tracks the current working directory for stepwise navigation.
      * <p/>
@@ -253,6 +258,11 @@ public class MinaSftpOperations
     private ClientSession createSession(RemoteFileConfiguration configuration) 
throws IOException {
         MinaSftpConfiguration sftpConfig = getMinaSftpConfiguration();
 
+        // Validate buffer sizes before connecting — configureBufferSizes() 
does not use the session,
+        // so running it here (before connectToServer) avoids leaking an 
authenticated SSH session when
+        // an invalid buffer size is configured. If it throws, no TCP 
connection has been opened yet.
+        configureBufferSizes(sftpConfig);
+
         // Create and configure SSH client if not already done
         if (sshClient == null) {
             sshClient = createAndConfigureSshClient(sftpConfig);
@@ -268,7 +278,6 @@ public class MinaSftpOperations
         if (sftpConfig.getCompression() > 0) {
             logCompressionNegotiationResult(newSession, sftpConfig);
         }
-        configureBufferSizes(newSession, sftpConfig);
 
         return newSession;
     }
@@ -490,9 +499,17 @@ public class MinaSftpOperations
      * {@link #BULK_REQUEST_SIZE} bytes.
      * <p/>
      * The maximum buffer size is capped at {@link #MAX_BUFFER_SIZE} to avoid 
data corruption issues in MINA SSHD.
+     * <p/>
+     * The resulting sizes are stored in {@link #effectiveReadBufferSize} and 
{@link #effectiveWriteBufferSize} and
+     * passed directly to {@link SftpClient#read(String, int, 
java.util.Collection)} and
+     * {@link SftpClient#write(String, int, java.util.Collection)} on each 
transfer. Setting
+     * {@code SftpModuleProperties} on the session does not affect those calls 
— the module properties are only
+     * consulted by {@code SftpFileSystemProvider}, not by the {@code 
SftpClient} stream methods.
+     *
+     * @param config the SFTP configuration
      */
-    private void configureBufferSizes(ClientSession session, 
MinaSftpConfiguration config) {
-        // Priority: explicit buffer sizes > bulkRequests (deprecated) > 
defaults
+    private void configureBufferSizes(MinaSftpConfiguration config) {
+        // Priority: explicit buffer sizes > bulkRequests (deprecated) > 0 
(let MINA SSHD use its own default)
         Integer readBuffer = config.getReadBufferSize();
         Integer writeBuffer = config.getWriteBufferSize();
 
@@ -513,16 +530,29 @@ public class MinaSftpOperations
             }
         }
 
-        // Apply read buffer size
-        if (readBuffer != null && readBuffer > 0) {
-            LOG.debug("Configuring read buffer size: {} bytes", readBuffer);
-            SftpModuleProperties.READ_BUFFER_SIZE.set(session, readBuffer);
+        // Store the effective sizes, capped at MAX_BUFFER_SIZE; 0 means "use 
MINA SSHD's default"
+        effectiveReadBufferSize = (readBuffer != null && readBuffer > 0) ? 
Math.min(readBuffer, MAX_BUFFER_SIZE) : 0;
+        effectiveWriteBufferSize = (writeBuffer != null && writeBuffer > 0) ? 
Math.min(writeBuffer, MAX_BUFFER_SIZE) : 0;
+
+        // Validate minimum: values 1-255 are below MINA SSHD's 
MIN_READ/WRITE_BUFFER_SIZE (256)
+        if (effectiveReadBufferSize > 0 && effectiveReadBufferSize < 256) {
+            throw new GenericFileOperationFailedException(
+                    "readBufferSize " + effectiveReadBufferSize
+                                                          + " is below the 
minimum of 256 bytes required by MINA SSHD."
+                                                          + " Use 0 for the 
MINA SSHD default or at least 256.");
+        }
+        if (effectiveWriteBufferSize > 0 && effectiveWriteBufferSize < 256) {
+            throw new GenericFileOperationFailedException(
+                    "writeBufferSize " + effectiveWriteBufferSize
+                                                          + " is below the 
minimum of 256 bytes required by MINA SSHD."
+                                                          + " Use 0 for the 
MINA SSHD default or at least 256.");
         }
 
-        // Apply write buffer size
-        if (writeBuffer != null && writeBuffer > 0) {
-            LOG.debug("Configuring write buffer size: {} bytes", writeBuffer);
-            SftpModuleProperties.WRITE_BUFFER_SIZE.set(session, writeBuffer);
+        if (effectiveReadBufferSize > 0) {
+            LOG.debug("Effective read buffer size: {} bytes", 
effectiveReadBufferSize);
+        }
+        if (effectiveWriteBufferSize > 0) {
+            LOG.debug("Effective write buffer size: {} bytes", 
effectiveWriteBufferSize);
         }
     }
 
@@ -1421,7 +1451,7 @@ public class MinaSftpOperations
                     = (GenericFile<SftpRemoteFile>) 
exchange.getProperty(FileComponent.FILE_EXCHANGE_FILE);
             ObjectHelper.notNull(target, "Exchange should have the " + 
FileComponent.FILE_EXCHANGE_FILE + " set");
 
-            InputStream is = sftpClient.read(name);
+            InputStream is = sftpClient.read(name, effectiveReadBufferSize);
 
             if (endpoint.getConfiguration().isStreamDownload()) {
                 // Streaming mode: pass InputStream directly to downstream 
processors
@@ -1487,7 +1517,7 @@ public class MinaSftpOperations
             // producer moves it to the target instead of copying it
             exchange.getIn().setHeader(FtpConstants.FILE_LOCAL_WORK_PATH, 
local.getPath());
 
-            try (InputStream is = sftpClient.read(name);
+            try (InputStream is = sftpClient.read(name, 
effectiveReadBufferSize);
                  OutputStream os = new FileOutputStream(temp)) {
                 IOHelper.copy(is, os);
             } catch (IOException e) {
@@ -1604,7 +1634,7 @@ public class MinaSftpOperations
                 modes = EnumSet.of(OpenMode.Write, OpenMode.Create, 
OpenMode.Truncate);
             }
 
-            try (OutputStream os = sftpClient.write(name, modes)) {
+            try (OutputStream os = sftpClient.write(name, 
effectiveWriteBufferSize, modes)) {
                 IOHelper.copy(is, os);
             } finally {
                 IOHelper.close(is);
@@ -1627,7 +1657,7 @@ public class MinaSftpOperations
             LOG.debug("Storing file directly: {}", name);
             reconnectIfNecessary(null);
 
-            try (OutputStream os = sftpClient.write(name)) {
+            try (OutputStream os = sftpClient.write(name, 
effectiveWriteBufferSize)) {
                 os.write(payload.getBytes());
             }
             return true;
diff --git 
a/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/MinaSftpOperationsBufferSizeTest.java
 
b/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/MinaSftpOperationsBufferSizeTest.java
new file mode 100644
index 000000000000..6315151b018d
--- /dev/null
+++ 
b/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/MinaSftpOperationsBufferSizeTest.java
@@ -0,0 +1,244 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.file.remote.mina;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.camel.component.file.GenericFileOperationFailedException;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Unit tests that verify CAMEL-27915: readBufferSize, writeBufferSize, and 
bulkRequests are propagated to the
+ * SftpClient.read()/write() calls rather than being silently dropped.
+ * <p>
+ * Before the fix, {@code configureBufferSizes} only called {@code 
SftpModuleProperties.set(session, ...)} which is
+ * consulted only by {@code SftpFileSystemProvider}, not by {@code 
SftpClient.read()/write()}. The transfer calls always
+ * used zero-bufferSize overloads, ignoring the configured sizes. The 
effective buffer sizes were never stored anywhere
+ * accessible to the read/write call sites.
+ * <p>
+ * After the fix, the effective buffer sizes are stored in {@code 
effectiveReadBufferSize} and
+ * {@code effectiveWriteBufferSize} fields and passed directly to {@code 
read(name, bufferSize)} and
+ * {@code write(name, bufferSize, modes)}.
+ */
+class MinaSftpOperationsBufferSizeTest {
+
+    /**
+     * Verifies that an explicit readBufferSize is captured in 
effectiveReadBufferSize.
+     */
+    @Test
+    void testExplicitReadBufferSizePropagated() throws Exception {
+        MinaSftpConfiguration config = new MinaSftpConfiguration();
+        config.setReadBufferSize(65536);
+
+        MinaSftpOperations ops = new MinaSftpOperations();
+        invokeConfigureBufferSizes(ops, config);
+
+        assertEquals(65536, getIntField(ops, "effectiveReadBufferSize"),
+                "effectiveReadBufferSize must hold the configured 
readBufferSize (CAMEL-27915)");
+    }
+
+    /**
+     * Verifies that an explicit writeBufferSize is captured in 
effectiveWriteBufferSize.
+     */
+    @Test
+    void testExplicitWriteBufferSizePropagated() throws Exception {
+        MinaSftpConfiguration config = new MinaSftpConfiguration();
+        config.setWriteBufferSize(98304);
+
+        MinaSftpOperations ops = new MinaSftpOperations();
+        invokeConfigureBufferSizes(ops, config);
+
+        assertEquals(98304, getIntField(ops, "effectiveWriteBufferSize"),
+                "effectiveWriteBufferSize must hold the configured 
writeBufferSize (CAMEL-27915)");
+    }
+
+    /**
+     * Verifies that when neither size is configured, the effective sizes are 
0 (meaning MINA SSHD picks its own default
+     * for read/write).
+     */
+    @Test
+    void testDefaultBufferSizesAreZero() throws Exception {
+        MinaSftpConfiguration config = new MinaSftpConfiguration();
+
+        MinaSftpOperations ops = new MinaSftpOperations();
+        invokeConfigureBufferSizes(ops, config);
+
+        assertEquals(0, getIntField(ops, "effectiveReadBufferSize"),
+                "effectiveReadBufferSize must be 0 when not configured (MINA 
SSHD uses its own default)");
+        assertEquals(0, getIntField(ops, "effectiveWriteBufferSize"),
+                "effectiveWriteBufferSize must be 0 when not configured (MINA 
SSHD uses its own default)");
+    }
+
+    /**
+     * Verifies backward compatibility: bulkRequests sets both effective 
buffer sizes when neither explicit size is set.
+     * Each bulk request corresponds to 32 KB, capped at the internal 
MAX_BUFFER_SIZE (126 * 1024 + 512 = 129536).
+     */
+    @ParameterizedTest
+    @CsvSource({
+            "1, 32768",   // 1 * 32KB = 32KB
+            "2, 65536",   // 2 * 32KB = 64KB
+            "4, 129536",  // 4 * 32KB = 131072 → capped at MAX_BUFFER_SIZE 
(126*1024+512)
+            "10, 129536"  // well above cap → capped at MAX_BUFFER_SIZE
+    })
+    @SuppressWarnings("deprecation")
+    void testBulkRequestsConvertedToBufferSizes(int bulkRequests, int 
expectedBuffer) throws Exception {
+        MinaSftpConfiguration config = new MinaSftpConfiguration();
+        config.setBulkRequests(bulkRequests);
+
+        MinaSftpOperations ops = new MinaSftpOperations();
+        invokeConfigureBufferSizes(ops, config);
+
+        assertEquals(expectedBuffer, getIntField(ops, 
"effectiveReadBufferSize"),
+                "effectiveReadBufferSize should equal " + expectedBuffer + " 
for bulkRequests=" + bulkRequests);
+        assertEquals(expectedBuffer, getIntField(ops, 
"effectiveWriteBufferSize"),
+                "effectiveWriteBufferSize should equal " + expectedBuffer + " 
for bulkRequests=" + bulkRequests);
+    }
+
+    /**
+     * Verifies that an explicit readBufferSize takes precedence over 
bulkRequests for the read path, while the write
+     * path falls back to the bulkRequests calculation when writeBufferSize is 
not set.
+     */
+    @Test
+    @SuppressWarnings("deprecation")
+    void testExplicitReadBufferOverridesBulkRequests() throws Exception {
+        MinaSftpConfiguration config = new MinaSftpConfiguration();
+        config.setBulkRequests(4);       // would compute to 129536 bytes
+        config.setReadBufferSize(65536); // explicit value should win for read
+
+        MinaSftpOperations ops = new MinaSftpOperations();
+        invokeConfigureBufferSizes(ops, config);
+
+        assertEquals(65536, getIntField(ops, "effectiveReadBufferSize"),
+                "explicit readBufferSize must override bulkRequests for 
reads");
+        assertEquals(129536, getIntField(ops, "effectiveWriteBufferSize"),
+                "effectiveWriteBufferSize should use bulkRequests when 
writeBufferSize is not set");
+    }
+
+    /**
+     * Verifies that an explicit writeBufferSize takes precedence over 
bulkRequests for the write path, while the read
+     * path falls back to the bulkRequests calculation when readBufferSize is 
not set.
+     */
+    @Test
+    @SuppressWarnings("deprecation")
+    void testExplicitWriteBufferOverridesBulkRequests() throws Exception {
+        MinaSftpConfiguration config = new MinaSftpConfiguration();
+        config.setBulkRequests(4);        // would compute to 129536 bytes
+        config.setWriteBufferSize(32768); // explicit value should win for 
write
+
+        MinaSftpOperations ops = new MinaSftpOperations();
+        invokeConfigureBufferSizes(ops, config);
+
+        assertEquals(129536, getIntField(ops, "effectiveReadBufferSize"),
+                "effectiveReadBufferSize should use bulkRequests when 
readBufferSize is not set");
+        assertEquals(32768, getIntField(ops, "effectiveWriteBufferSize"),
+                "explicit writeBufferSize must override bulkRequests for 
writes");
+    }
+
+    // 
---------------------------------------------------------------------------
+    // Validation and capping tests
+    // 
---------------------------------------------------------------------------
+
+    /**
+     * Values in the range 1-255 are rejected with 
GenericFileOperationFailedException.
+     */
+    @Test
+    public void testReadBufferSizeBelowMinimumThrows() {
+        MinaSftpConfiguration config = new MinaSftpConfiguration();
+        config.setReadBufferSize(100);
+
+        MinaSftpOperations ops = new MinaSftpOperations();
+        Exception ex = assertThrows(Exception.class,
+                () -> invokeConfigureBufferSizes(ops, config),
+                "readBufferSize in range 1-255 must throw");
+        Throwable cause = ex instanceof InvocationTargetException ? 
ex.getCause() : ex;
+        assertTrue(cause instanceof GenericFileOperationFailedException,
+                "expected GenericFileOperationFailedException but got " + 
cause.getClass());
+    }
+
+    /**
+     * Values in the range 1-255 are rejected for writeBufferSize too.
+     */
+    @Test
+    public void testWriteBufferSizeBelowMinimumThrows() {
+        MinaSftpConfiguration config = new MinaSftpConfiguration();
+        config.setWriteBufferSize(255);
+
+        MinaSftpOperations ops = new MinaSftpOperations();
+        Exception ex = assertThrows(Exception.class,
+                () -> invokeConfigureBufferSizes(ops, config),
+                "writeBufferSize in range 1-255 must throw");
+        Throwable cause = ex instanceof InvocationTargetException ? 
ex.getCause() : ex;
+        assertTrue(cause instanceof GenericFileOperationFailedException,
+                "expected GenericFileOperationFailedException but got " + 
cause.getClass());
+    }
+
+    /**
+     * Values above MAX_BUFFER_SIZE (129536) are silently capped to 129536.
+     */
+    @Test
+    public void testReadBufferSizeCappedAtMax() throws Exception {
+        MinaSftpConfiguration config = new MinaSftpConfiguration();
+        config.setReadBufferSize(500_000);
+
+        MinaSftpOperations ops = new MinaSftpOperations();
+        invokeConfigureBufferSizes(ops, config);
+
+        assertEquals(129536, getIntField(ops, "effectiveReadBufferSize"),
+                "readBufferSize above MAX_BUFFER_SIZE must be capped at 
129536");
+    }
+
+    /**
+     * Values above MAX_BUFFER_SIZE (129536) are silently capped to 129536 for 
write too.
+     */
+    @Test
+    public void testWriteBufferSizeCappedAtMax() throws Exception {
+        MinaSftpConfiguration config = new MinaSftpConfiguration();
+        config.setWriteBufferSize(500_000);
+
+        MinaSftpOperations ops = new MinaSftpOperations();
+        invokeConfigureBufferSizes(ops, config);
+
+        assertEquals(129536, getIntField(ops, "effectiveWriteBufferSize"),
+                "writeBufferSize above MAX_BUFFER_SIZE must be capped at 
129536");
+    }
+
+    // 
---------------------------------------------------------------------------
+    // Helpers
+    // 
---------------------------------------------------------------------------
+
+    /** Calls the private configureBufferSizes(MinaSftpConfiguration) via 
reflection. */
+    private static void invokeConfigureBufferSizes(MinaSftpOperations ops, 
MinaSftpConfiguration config)
+            throws Exception {
+        Method m = 
MinaSftpOperations.class.getDeclaredMethod("configureBufferSizes", 
MinaSftpConfiguration.class);
+        m.setAccessible(true);
+        m.invoke(ops, config);
+    }
+
+    private static int getIntField(Object target, String name) throws 
Exception {
+        Field f = target.getClass().getDeclaredField(name);
+        f.setAccessible(true);
+        return f.getInt(target);
+    }
+}
diff --git 
a/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/sftp/SftpBufferSizeOnWireIT.java
 
b/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/sftp/SftpBufferSizeOnWireIT.java
new file mode 100644
index 000000000000..25f33890a6fe
--- /dev/null
+++ 
b/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/sftp/SftpBufferSizeOnWireIT.java
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.file.remote.mina.sftp;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.infra.ftp.services.embedded.SftpEmbeddedService;
+import org.apache.sshd.server.session.ServerSession;
+import org.apache.sshd.sftp.server.FileHandle;
+import org.apache.sshd.sftp.server.SftpEventListener;
+import org.apache.sshd.sftp.server.SftpSubsystemFactory;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledIf;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * On-the-wire integration test proving that readBufferSize and 
writeBufferSize are actually honoured by the SFTP
+ * transfer (CAMEL-27915). A custom {@link SftpEmbeddedService} subclass 
records the maximum {@code dataLen} seen in
+ * {@link SftpEventListener#reading} and {@link SftpEventListener#writing} 
callbacks.
+ */
+@EnabledIf(value = 
"org.apache.camel.test.infra.ftp.services.embedded.SftpUtil#hasRequiredAlgorithms('src/test/resources/sftp/hostkey.pem')")
+public class SftpBufferSizeOnWireIT extends BaseServerTestSupport {
+
+    private static final int BUFFER_SIZE = 4096;
+    private static final int FILE_SIZE = 300 * 1024; // 300 KB
+
+    @RegisterExtension
+    RecordingDataLenSftpService service = new RecordingDataLenSftpService();
+
+    @Test
+    void writeBufferSizeHonouredOnWire() throws Exception {
+        byte[] payload = new byte[FILE_SIZE];
+        for (int i = 0; i < payload.length; i++) {
+            payload[i] = (byte) (i & 0xFF);
+        }
+
+        String uri = "mina-sftp://localhost:"; + service.getPort() + "/" + 
service.getFtpRootDir()
+                     + 
"?username=admin&password=admin&disconnect=true&knownHostsFile="
+                     + service.getKnownHostsFile()
+                     + "&writeBufferSize=" + BUFFER_SIZE;
+
+        template.sendBodyAndHeader(uri, payload, Exchange.FILE_NAME, 
"write-test.bin");
+
+        int maxWrite = service.getMaxWriteDataLen();
+        assertTrue(maxWrite > 0, "Server should have observed at least one 
write");
+        // MINA SSHD prepends a 5-byte SSH packet header to each write, so the 
data payload
+        // seen in the SftpEventListener is slightly smaller than 
writeBufferSize.
+        assertTrue(maxWrite <= BUFFER_SIZE,
+                "Max write chunk on the wire (" + maxWrite + ") should not 
exceed writeBufferSize=" + BUFFER_SIZE);
+        assertTrue(maxWrite >= BUFFER_SIZE - 64,
+                "Max write chunk on the wire (" + maxWrite + ") should be 
close to writeBufferSize=" + BUFFER_SIZE
+                                                 + " (within 64 bytes for SSH 
packet header overhead)");
+    }
+
+    @Test
+    void readBufferSizeHonouredOnWire() throws Exception {
+        // Write a 300KB file into the SFTP root directory
+        Path targetFile = service.getFtpRootDir().resolve("read-test.bin");
+        byte[] payload = new byte[FILE_SIZE];
+        for (int i = 0; i < payload.length; i++) {
+            payload[i] = (byte) (i & 0xFF);
+        }
+        Files.write(targetFile, payload);
+
+        service.resetMaxReadDataLen();
+
+        MockEndpoint mock = getMockEndpoint("mock:read-result");
+        mock.expectedMessageCount(1);
+
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() {
+                from("mina-sftp://localhost:"; + service.getPort() + "/" + 
service.getFtpRootDir()
+                     + 
"?username=admin&password=admin&disconnect=true&knownHostsFile="
+                     + service.getKnownHostsFile()
+                     + "&readBufferSize=" + BUFFER_SIZE
+                     + "&noop=true")
+                        .routeId("read-route").to("mock:read-result");
+            }
+        });
+
+        MockEndpoint.assertIsSatisfied(context);
+
+        int maxRead = service.getMaxReadDataLen();
+        assertTrue(maxRead > 0, "Server should have observed at least one 
read");
+        // For reads, MINA SSHD sends the full readBufferSize as the requested 
data length in each
+        // SSH_FXP_READ packet; the server records exactly that value in the 
SftpEventListener callback.
+        assertEquals(BUFFER_SIZE, maxRead,
+                "Max read chunk on the wire should be exactly readBufferSize=" 
+ BUFFER_SIZE);
+    }
+
+    /**
+     * Embedded SFTP service that records the maximum {@code dataLen} observed 
in writing and reading callbacks.
+     */
+    static class RecordingDataLenSftpService extends SftpEmbeddedService {
+
+        private final AtomicInteger maxWriteDataLen = new AtomicInteger(0);
+        private final AtomicInteger maxReadDataLen = new AtomicInteger(0);
+
+        @Override
+        public void setUpServer() throws Exception {
+            super.setUpServer();
+            SftpSubsystemFactory factory = (SftpSubsystemFactory) 
sshd.getSubsystemFactories().get(0);
+            factory.addSftpEventListener(new SftpEventListener() {
+                @Override
+                public void writing(
+                        ServerSession session, String remoteHandle, FileHandle 
localHandle,
+                        long offset, byte[] data, int dataOffset, int dataLen) 
{
+                    maxWriteDataLen.accumulateAndGet(dataLen, Math::max);
+                }
+
+                @Override
+                public void reading(
+                        ServerSession session, String remoteHandle, FileHandle 
localHandle,
+                        long offset, byte[] data, int dataOffset, int dataLen) 
{
+                    maxReadDataLen.accumulateAndGet(dataLen, Math::max);
+                }
+            });
+        }
+
+        int getMaxWriteDataLen() {
+            return maxWriteDataLen.get();
+        }
+
+        int getMaxReadDataLen() {
+            return maxReadDataLen.get();
+        }
+
+        void resetMaxReadDataLen() {
+            maxReadDataLen.set(0);
+        }
+    }
+}
diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
index f9626f2db33f..fc24ce5fe1ba 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
@@ -349,6 +349,24 @@ As a result, applications that use `camel-infinispan` no 
longer get `infinispan-
 Hibernate Search or Lucene on their classpath through it. If your application 
also starts an embedded cache manager or
 uses the embedded query engine, use `camel-infinispan-embedded`, or add these 
dependencies yourself.
 
+=== camel-mina-sftp - readBufferSize, writeBufferSize and bulkRequests now 
take effect
+
+The `readBufferSize` and `writeBufferSize` options of the `mina-sftp` 
component are now passed to the
+`SftpClient.read()` / `SftpClient.write()` calls and honoured on the wire. 
Before this fix, the configured values
+were stored but silently ignored by the transfer methods, which always used 
the MINA SSHD default buffer size.
+
+Validation and capping rules apply:
+
+* The minimum accepted value is `256`. Values in the range 1-255 are rejected 
with a
+  `GenericFileOperationFailedException` at connect time. Previously, such 
values were ignored and the MINA SSHD
+  default was used.
+* The maximum effective value is `129536` bytes (~126.5 KB). Values above this 
limit are capped silently, as larger
+  SFTP data frames can cause data corruption in Apache MINA SSHD (see 
SSHD-1069).
+* A value of `0` (or leaving the option unset) means the MINA SSHD default is 
used.
+
+The deprecated `bulkRequests` option, which was already converted to buffer 
sizes internally, is now also subject to
+the same minimum and maximum rules.
+
 === camel-pubnub - CamelMessageTimestamp now holds milliseconds
 
 The `CamelMessageTimestamp` header on PubNub message and presence events now 
holds the
diff --git 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/MinaSftpEndpointBuilderFactory.java
 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/MinaSftpEndpointBuilderFactory.java
index 4ba5904b5372..8b0b788b678b 100644
--- 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/MinaSftpEndpointBuilderFactory.java
+++ 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/MinaSftpEndpointBuilderFactory.java
@@ -3213,11 +3213,9 @@ public interface MinaSftpEndpointBuilderFactory {
             return this;
         }
         /**
-         * The read buffer size in bytes. Camel sets it as the Apache MINA SSHD
-         * session property sftp-fs-read-buffer-size, which only the SFTP file
-         * system of Apache MINA SSHD reads, not the SFTP client that this
-         * component uses. So this option currently has no effect: files are
-         * read in chunks of the SSH channel packet size.
+         * Size in bytes of each SFTP read request sent to the server. Must be 0
+         * (MINA SSHD default) or at least 256. Values above 129536 are capped.
+         * When not set, Apache MINA SSHD uses its own default.
          * 
          * The option is a: <code>java.lang.Integer</code> type.
          * 
@@ -3231,11 +3229,9 @@ public interface MinaSftpEndpointBuilderFactory {
             return this;
         }
         /**
-         * The read buffer size in bytes. Camel sets it as the Apache MINA SSHD
-         * session property sftp-fs-read-buffer-size, which only the SFTP file
-         * system of Apache MINA SSHD reads, not the SFTP client that this
-         * component uses. So this option currently has no effect: files are
-         * read in chunks of the SSH channel packet size.
+         * Size in bytes of each SFTP read request sent to the server. Must be 0
+         * (MINA SSHD default) or at least 256. Values above 129536 are capped.
+         * When not set, Apache MINA SSHD uses its own default.
          * 
          * The option will be converted to a <code>java.lang.Integer</code>
          * type.
@@ -3494,11 +3490,9 @@ public interface MinaSftpEndpointBuilderFactory {
             return this;
         }
         /**
-         * The write buffer size in bytes. Camel sets it as the Apache MINA 
SSHD
-         * session property sftp-fs-write-buffer-size, which only the SFTP file
-         * system of Apache MINA SSHD reads, not the SFTP client that this
-         * component uses. So this option currently has no effect: files are
-         * written in chunks of the SSH channel packet size.
+         * Size in bytes of each SFTP write request sent to the server. Must be
+         * 0 (MINA SSHD default) or at least 256. Values above 129536 are
+         * capped. When not set, Apache MINA SSHD uses its own default.
          * 
          * The option is a: <code>java.lang.Integer</code> type.
          * 
@@ -3512,11 +3506,9 @@ public interface MinaSftpEndpointBuilderFactory {
             return this;
         }
         /**
-         * The write buffer size in bytes. Camel sets it as the Apache MINA 
SSHD
-         * session property sftp-fs-write-buffer-size, which only the SFTP file
-         * system of Apache MINA SSHD reads, not the SFTP client that this
-         * component uses. So this option currently has no effect: files are
-         * written in chunks of the SSH channel packet size.
+         * Size in bytes of each SFTP write request sent to the server. Must be
+         * 0 (MINA SSHD default) or at least 256. Values above 129536 are
+         * capped. When not set, Apache MINA SSHD uses its own default.
          * 
          * The option will be converted to a <code>java.lang.Integer</code>
          * type.
@@ -5131,11 +5123,9 @@ public interface MinaSftpEndpointBuilderFactory {
             return this;
         }
         /**
-         * The read buffer size in bytes. Camel sets it as the Apache MINA SSHD
-         * session property sftp-fs-read-buffer-size, which only the SFTP file
-         * system of Apache MINA SSHD reads, not the SFTP client that this
-         * component uses. So this option currently has no effect: files are
-         * read in chunks of the SSH channel packet size.
+         * Size in bytes of each SFTP read request sent to the server. Must be 0
+         * (MINA SSHD default) or at least 256. Values above 129536 are capped.
+         * When not set, Apache MINA SSHD uses its own default.
          * 
          * The option is a: <code>java.lang.Integer</code> type.
          * 
@@ -5149,11 +5139,9 @@ public interface MinaSftpEndpointBuilderFactory {
             return this;
         }
         /**
-         * The read buffer size in bytes. Camel sets it as the Apache MINA SSHD
-         * session property sftp-fs-read-buffer-size, which only the SFTP file
-         * system of Apache MINA SSHD reads, not the SFTP client that this
-         * component uses. So this option currently has no effect: files are
-         * read in chunks of the SSH channel packet size.
+         * Size in bytes of each SFTP read request sent to the server. Must be 0
+         * (MINA SSHD default) or at least 256. Values above 129536 are capped.
+         * When not set, Apache MINA SSHD uses its own default.
          * 
          * The option will be converted to a <code>java.lang.Integer</code>
          * type.
@@ -5412,11 +5400,9 @@ public interface MinaSftpEndpointBuilderFactory {
             return this;
         }
         /**
-         * The write buffer size in bytes. Camel sets it as the Apache MINA 
SSHD
-         * session property sftp-fs-write-buffer-size, which only the SFTP file
-         * system of Apache MINA SSHD reads, not the SFTP client that this
-         * component uses. So this option currently has no effect: files are
-         * written in chunks of the SSH channel packet size.
+         * Size in bytes of each SFTP write request sent to the server. Must be
+         * 0 (MINA SSHD default) or at least 256. Values above 129536 are
+         * capped. When not set, Apache MINA SSHD uses its own default.
          * 
          * The option is a: <code>java.lang.Integer</code> type.
          * 
@@ -5430,11 +5416,9 @@ public interface MinaSftpEndpointBuilderFactory {
             return this;
         }
         /**
-         * The write buffer size in bytes. Camel sets it as the Apache MINA 
SSHD
-         * session property sftp-fs-write-buffer-size, which only the SFTP file
-         * system of Apache MINA SSHD reads, not the SFTP client that this
-         * component uses. So this option currently has no effect: files are
-         * written in chunks of the SSH channel packet size.
+         * Size in bytes of each SFTP write request sent to the server. Must be
+         * 0 (MINA SSHD default) or at least 256. Values above 129536 are
+         * capped. When not set, Apache MINA SSHD uses its own default.
          * 
          * The option will be converted to a <code>java.lang.Integer</code>
          * type.
@@ -6582,11 +6566,9 @@ public interface MinaSftpEndpointBuilderFactory {
             return this;
         }
         /**
-         * The read buffer size in bytes. Camel sets it as the Apache MINA SSHD
-         * session property sftp-fs-read-buffer-size, which only the SFTP file
-         * system of Apache MINA SSHD reads, not the SFTP client that this
-         * component uses. So this option currently has no effect: files are
-         * read in chunks of the SSH channel packet size.
+         * Size in bytes of each SFTP read request sent to the server. Must be 0
+         * (MINA SSHD default) or at least 256. Values above 129536 are capped.
+         * When not set, Apache MINA SSHD uses its own default.
          * 
          * The option is a: <code>java.lang.Integer</code> type.
          * 
@@ -6600,11 +6582,9 @@ public interface MinaSftpEndpointBuilderFactory {
             return this;
         }
         /**
-         * The read buffer size in bytes. Camel sets it as the Apache MINA SSHD
-         * session property sftp-fs-read-buffer-size, which only the SFTP file
-         * system of Apache MINA SSHD reads, not the SFTP client that this
-         * component uses. So this option currently has no effect: files are
-         * read in chunks of the SSH channel packet size.
+         * Size in bytes of each SFTP read request sent to the server. Must be 0
+         * (MINA SSHD default) or at least 256. Values above 129536 are capped.
+         * When not set, Apache MINA SSHD uses its own default.
          * 
          * The option will be converted to a <code>java.lang.Integer</code>
          * type.
@@ -6863,11 +6843,9 @@ public interface MinaSftpEndpointBuilderFactory {
             return this;
         }
         /**
-         * The write buffer size in bytes. Camel sets it as the Apache MINA 
SSHD
-         * session property sftp-fs-write-buffer-size, which only the SFTP file
-         * system of Apache MINA SSHD reads, not the SFTP client that this
-         * component uses. So this option currently has no effect: files are
-         * written in chunks of the SSH channel packet size.
+         * Size in bytes of each SFTP write request sent to the server. Must be
+         * 0 (MINA SSHD default) or at least 256. Values above 129536 are
+         * capped. When not set, Apache MINA SSHD uses its own default.
          * 
          * The option is a: <code>java.lang.Integer</code> type.
          * 
@@ -6881,11 +6859,9 @@ public interface MinaSftpEndpointBuilderFactory {
             return this;
         }
         /**
-         * The write buffer size in bytes. Camel sets it as the Apache MINA 
SSHD
-         * session property sftp-fs-write-buffer-size, which only the SFTP file
-         * system of Apache MINA SSHD reads, not the SFTP client that this
-         * component uses. So this option currently has no effect: files are
-         * written in chunks of the SSH channel packet size.
+         * Size in bytes of each SFTP write request sent to the server. Must be
+         * 0 (MINA SSHD default) or at least 256. Values above 129536 are
+         * capped. When not set, Apache MINA SSHD uses its own default.
          * 
          * The option will be converted to a <code>java.lang.Integer</code>
          * type.

Reply via email to