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 c1ca9bc511f2 CAMEL-26582: camel-azure-storage-datalake - flush at the 
absolute final position (#29155)
c1ca9bc511f2 is described below

commit c1ca9bc511f2d6cc47dae53cd1f26ea041385577
Author: Andrea Cosentino <[email protected]>
AuthorDate: Wed Nov 4 16:27:10 2026 +0100

    CAMEL-26582: camel-azure-storage-datalake - flush at the absolute final 
position (#29155)
    
    Co-authored-by: OpenAI Codex <[email protected]>
---
 .../catalog/components/azure-storage-datalake.json |  4 +-
 .../docs/azure-storage-datalake-component.adoc     | 11 +++--
 .../storage/datalake/azure-storage-datalake.json   |  4 +-
 .../docs/azure-storage-datalake-component.adoc     | 11 +++--
 .../storage/datalake/DataLakeConfiguration.java    |  2 +-
 .../operations/DataLakeFileOperations.java         |  2 +-
 .../operations/DataLakeFileOperationTest.java      | 47 ++++++++++++++++++++++
 .../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc    |  8 ++++
 ...zureStorageDatalakeComponentBuilderFactory.java |  4 +-
 .../dsl/DataLakeEndpointBuilderFactory.java        | 24 +++++------
 10 files changed, 91 insertions(+), 26 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-storage-datalake.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-storage-datalake.json
index 7d6723676e46..b49c5a7aec83 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-storage-datalake.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-storage-datalake.json
@@ -41,7 +41,7 @@
     "openOptions": { "index": 14, "kind": "property", "displayName": "Open 
Options", "group": "common", "label": "", "required": false, "type": "object", 
"javaType": "java.util.Set<java.nio.file.OpenOption>", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "set open options for 
creating file" },
     "path": { "index": 15, "kind": "property", "displayName": "Path", "group": 
"common", "label": "", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "path in azure data lake 
for operations" },
     "permission": { "index": 16, "kind": "property", "displayName": 
"Permission", "group": "common", "label": "", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "permission string for 
the file" },
-    "position": { "index": 17, "kind": "property", "displayName": "Position", 
"group": "common", "label": "", "required": false, "type": "integer", 
"javaType": "java.lang.Long", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "This parameter allows 
the caller to upload data in parallel and control the order in which it is 
appende [...]
+    "position": { "index": 17, "kind": "property", "displayName": "Position", 
"group": "common", "label": "", "required": false, "type": "integer", 
"javaType": "java.lang.Long", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "The final length of the 
file, including previously committed data, used by flushToFile." },
     "recursive": { "index": 18, "kind": "property", "displayName": 
"Recursive", "group": "common", "label": "", "required": false, "type": 
"boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "recursively include all 
paths" },
     "regex": { "index": 19, "kind": "property", "displayName": "Regex", 
"group": "common", "label": "", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "regular expression for 
matching file names" },
     "retainUncommitedData": { "index": 20, "kind": "property", "displayName": 
"Retain Uncommited Data", "group": "common", "label": "", "required": false, 
"type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, 
"configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "Whether or not 
uncommitted data is to be retained af [...]
@@ -153,7 +153,7 @@
     "openOptions": { "index": 16, "kind": "parameter", "displayName": "Open 
Options", "group": "common", "label": "", "required": false, "type": "object", 
"javaType": "java.util.Set<java.nio.file.OpenOption>", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "set open options for 
creating file" },
     "path": { "index": 17, "kind": "parameter", "displayName": "Path", 
"group": "common", "label": "", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "path in azure data lake 
for operations" },
     "permission": { "index": 18, "kind": "parameter", "displayName": 
"Permission", "group": "common", "label": "", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "permission string for 
the file" },
-    "position": { "index": 19, "kind": "parameter", "displayName": "Position", 
"group": "common", "label": "", "required": false, "type": "integer", 
"javaType": "java.lang.Long", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "This parameter allows 
the caller to upload data in parallel and control the order in which it is 
append [...]
+    "position": { "index": 19, "kind": "parameter", "displayName": "Position", 
"group": "common", "label": "", "required": false, "type": "integer", 
"javaType": "java.lang.Long", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "The final length of the 
file, including previously committed data, used by flushToFile." },
     "recursive": { "index": 20, "kind": "parameter", "displayName": 
"Recursive", "group": "common", "label": "", "required": false, "type": 
"boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "recursively include all 
paths" },
     "regex": { "index": 21, "kind": "parameter", "displayName": "Regex", 
"group": "common", "label": "", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "regular expression for 
matching file names" },
     "retainUncommitedData": { "index": 22, "kind": "parameter", "displayName": 
"Retain Uncommited Data", "group": "common", "label": "", "required": false, 
"type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, 
"configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "Whether or not 
uncommitted data is to be retained a [...]
diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/azure-storage-datalake-component.adoc
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/azure-storage-datalake-component.adoc
index bb9b613fd5fa..526f4fbcbad5 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/azure-storage-datalake-component.adoc
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/azure-storage-datalake-component.adoc
@@ -560,6 +560,11 @@ from("direct:start")
 
 -  `flushToFile`
 
+Set `position` or the `CamelAzureStorageDataLakePosition` header to the final 
file length in bytes,
+including any previously committed data. For example, after appending 20 bytes 
to a 100-byte file,
+set the position to `120`. The header overrides the endpoint option. If 
neither is set, the operation
+uses the current committed file length; set the final position explicitly to 
commit newly appended data.
+
 [tabs]
 ====
 Java::
@@ -567,7 +572,7 @@ Java::
 [source,java]
 ----
 from("direct:start")
-    .setHeader("CamelAzureStorageDataLakePosition", constant(0))
+    .setHeader("CamelAzureStorageDataLakePosition", constant(120))
     
.to("azure-storage-datalake:cameltesting/filesystem?operation=flushToFile&fileName=test.txt&serviceClient=#serviceClient")
     .to("mock:results");
 ----
@@ -579,7 +584,7 @@ XML::
 <route>
   <from uri="direct:start"/>
   <setHeader name="CamelAzureStorageDataLakePosition">
-    <constant>0</constant>
+    <constant>120</constant>
   </setHeader>
   <to 
uri="azure-storage-datalake:cameltesting/filesystem?operation=flushToFile&amp;fileName=test.txt&amp;serviceClient=#serviceClient"/>
   <to uri="mock:results"/>
@@ -596,7 +601,7 @@ YAML::
       steps:
         - setHeader:
             name: CamelAzureStorageDataLakePosition
-            constant: 0
+            constant: 120
         - to:
             uri: azure-storage-datalake:cameltesting/filesystem
             parameters:
diff --git 
a/components/camel-azure/camel-azure-storage-datalake/src/generated/resources/META-INF/org/apache/camel/component/azure/storage/datalake/azure-storage-datalake.json
 
b/components/camel-azure/camel-azure-storage-datalake/src/generated/resources/META-INF/org/apache/camel/component/azure/storage/datalake/azure-storage-datalake.json
index 7d6723676e46..b49c5a7aec83 100644
--- 
a/components/camel-azure/camel-azure-storage-datalake/src/generated/resources/META-INF/org/apache/camel/component/azure/storage/datalake/azure-storage-datalake.json
+++ 
b/components/camel-azure/camel-azure-storage-datalake/src/generated/resources/META-INF/org/apache/camel/component/azure/storage/datalake/azure-storage-datalake.json
@@ -41,7 +41,7 @@
     "openOptions": { "index": 14, "kind": "property", "displayName": "Open 
Options", "group": "common", "label": "", "required": false, "type": "object", 
"javaType": "java.util.Set<java.nio.file.OpenOption>", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "set open options for 
creating file" },
     "path": { "index": 15, "kind": "property", "displayName": "Path", "group": 
"common", "label": "", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "autowired": false, "secret": false, 
"configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "path in azure data lake 
for operations" },
     "permission": { "index": 16, "kind": "property", "displayName": 
"Permission", "group": "common", "label": "", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "permission string for 
the file" },
-    "position": { "index": 17, "kind": "property", "displayName": "Position", 
"group": "common", "label": "", "required": false, "type": "integer", 
"javaType": "java.lang.Long", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "This parameter allows 
the caller to upload data in parallel and control the order in which it is 
appende [...]
+    "position": { "index": 17, "kind": "property", "displayName": "Position", 
"group": "common", "label": "", "required": false, "type": "integer", 
"javaType": "java.lang.Long", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "The final length of the 
file, including previously committed data, used by flushToFile." },
     "recursive": { "index": 18, "kind": "property", "displayName": 
"Recursive", "group": "common", "label": "", "required": false, "type": 
"boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "recursively include all 
paths" },
     "regex": { "index": 19, "kind": "property", "displayName": "Regex", 
"group": "common", "label": "", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "regular expression for 
matching file names" },
     "retainUncommitedData": { "index": 20, "kind": "property", "displayName": 
"Retain Uncommited Data", "group": "common", "label": "", "required": false, 
"type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, 
"configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "Whether or not 
uncommitted data is to be retained af [...]
@@ -153,7 +153,7 @@
     "openOptions": { "index": 16, "kind": "parameter", "displayName": "Open 
Options", "group": "common", "label": "", "required": false, "type": "object", 
"javaType": "java.util.Set<java.nio.file.OpenOption>", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "set open options for 
creating file" },
     "path": { "index": 17, "kind": "parameter", "displayName": "Path", 
"group": "common", "label": "", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "path in azure data lake 
for operations" },
     "permission": { "index": 18, "kind": "parameter", "displayName": 
"Permission", "group": "common", "label": "", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "permission string for 
the file" },
-    "position": { "index": 19, "kind": "parameter", "displayName": "Position", 
"group": "common", "label": "", "required": false, "type": "integer", 
"javaType": "java.lang.Long", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "This parameter allows 
the caller to upload data in parallel and control the order in which it is 
append [...]
+    "position": { "index": 19, "kind": "parameter", "displayName": "Position", 
"group": "common", "label": "", "required": false, "type": "integer", 
"javaType": "java.lang.Long", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "The final length of the 
file, including previously committed data, used by flushToFile." },
     "recursive": { "index": 20, "kind": "parameter", "displayName": 
"Recursive", "group": "common", "label": "", "required": false, "type": 
"boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "recursively include all 
paths" },
     "regex": { "index": 21, "kind": "parameter", "displayName": "Regex", 
"group": "common", "label": "", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "regular expression for 
matching file names" },
     "retainUncommitedData": { "index": 22, "kind": "parameter", "displayName": 
"Retain Uncommited Data", "group": "common", "label": "", "required": false, 
"type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, 
"configurationClass": 
"org.apache.camel.component.azure.storage.datalake.DataLakeConfiguration", 
"configurationField": "configuration", "description": "Whether or not 
uncommitted data is to be retained a [...]
diff --git 
a/components/camel-azure/camel-azure-storage-datalake/src/main/docs/azure-storage-datalake-component.adoc
 
b/components/camel-azure/camel-azure-storage-datalake/src/main/docs/azure-storage-datalake-component.adoc
index bb9b613fd5fa..526f4fbcbad5 100644
--- 
a/components/camel-azure/camel-azure-storage-datalake/src/main/docs/azure-storage-datalake-component.adoc
+++ 
b/components/camel-azure/camel-azure-storage-datalake/src/main/docs/azure-storage-datalake-component.adoc
@@ -560,6 +560,11 @@ from("direct:start")
 
 -  `flushToFile`
 
+Set `position` or the `CamelAzureStorageDataLakePosition` header to the final 
file length in bytes,
+including any previously committed data. For example, after appending 20 bytes 
to a 100-byte file,
+set the position to `120`. The header overrides the endpoint option. If 
neither is set, the operation
+uses the current committed file length; set the final position explicitly to 
commit newly appended data.
+
 [tabs]
 ====
 Java::
@@ -567,7 +572,7 @@ Java::
 [source,java]
 ----
 from("direct:start")
-    .setHeader("CamelAzureStorageDataLakePosition", constant(0))
+    .setHeader("CamelAzureStorageDataLakePosition", constant(120))
     
.to("azure-storage-datalake:cameltesting/filesystem?operation=flushToFile&fileName=test.txt&serviceClient=#serviceClient")
     .to("mock:results");
 ----
@@ -579,7 +584,7 @@ XML::
 <route>
   <from uri="direct:start"/>
   <setHeader name="CamelAzureStorageDataLakePosition">
-    <constant>0</constant>
+    <constant>120</constant>
   </setHeader>
   <to 
uri="azure-storage-datalake:cameltesting/filesystem?operation=flushToFile&amp;fileName=test.txt&amp;serviceClient=#serviceClient"/>
   <to uri="mock:results"/>
@@ -596,7 +601,7 @@ YAML::
       steps:
         - setHeader:
             name: CamelAzureStorageDataLakePosition
-            constant: 0
+            constant: 120
         - to:
             uri: azure-storage-datalake:cameltesting/filesystem
             parameters:
diff --git 
a/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/DataLakeConfiguration.java
 
b/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/DataLakeConfiguration.java
index 9dba91f3ed14..bd067ba5fe1f 100644
--- 
a/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/DataLakeConfiguration.java
+++ 
b/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/DataLakeConfiguration.java
@@ -87,7 +87,7 @@ public class DataLakeConfiguration implements Cloneable {
     private Boolean retainUncommitedData = false;
     @UriParam(description = "Whether or not a file changed event raised 
indicates completion (true) or modification (false)")
     private Boolean close = false;
-    @UriParam(description = "This parameter allows the caller to upload data 
in parallel and control the order in which it is appended to the file.")
+    @UriParam(description = "The final length of the file, including 
previously committed data, used by flushToFile.")
     private Long position;
     @UriParam(description = "expression for queryInputStream")
     private String expression;
diff --git 
a/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/operations/DataLakeFileOperations.java
 
b/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/operations/DataLakeFileOperations.java
index 9de5d07909c4..6f4c13984fe9 100644
--- 
a/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/operations/DataLakeFileOperations.java
+++ 
b/components/camel-azure/camel-azure-storage-datalake/src/main/java/org/apache/camel/component/azure/storage/datalake/operations/DataLakeFileOperations.java
@@ -188,7 +188,7 @@ public class DataLakeFileOperations {
         final Boolean retainUncommitedData = 
configurationProxy.retainUnCommitedData(exchange);
         final Boolean close = configurationProxy.getClose(exchange);
         final DataLakeFileClientWrapper fileClientWrapper = 
getFileClientWrapper(exchange);
-        final long flushPosition = (position != null ? position : 0L) + 
fileClientWrapper.getFileSize();
+        final long flushPosition = position != null ? position : 
fileClientWrapper.getFileSize();
         final Response<PathInfo> response
                 = fileClientWrapper.flushWithResponse(flushPosition, 
retainUncommitedData, close,
                         commonRequestOptions.getPathHttpHeaders(), 
commonRequestOptions.getRequestConditions(),
diff --git 
a/components/camel-azure/camel-azure-storage-datalake/src/test/java/org/apache/camel/component/azure/storage/datalake/operations/DataLakeFileOperationTest.java
 
b/components/camel-azure/camel-azure-storage-datalake/src/test/java/org/apache/camel/component/azure/storage/datalake/operations/DataLakeFileOperationTest.java
index 7a8d25f35544..6aec092b50d3 100644
--- 
a/components/camel-azure/camel-azure-storage-datalake/src/test/java/org/apache/camel/component/azure/storage/datalake/operations/DataLakeFileOperationTest.java
+++ 
b/components/camel-azure/camel-azure-storage-datalake/src/test/java/org/apache/camel/component/azure/storage/datalake/operations/DataLakeFileOperationTest.java
@@ -48,7 +48,10 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 @TestInstance(TestInstance.Lifecycle.PER_CLASS)
@@ -94,6 +97,50 @@ public class DataLakeFileOperationTest extends 
CamelTestSupport {
         assertNotNull(secondResponse.getHeaders());
     }
 
+    @Test
+    void testFlushUsesAbsoluteHeaderPosition() {
+        when(client.flushWithResponse(anyLong(), any(), any(), any(), any(), 
any()))
+                .thenReturn(new ResponseBase<>(
+                        null, 200, new HttpHeaders(),
+                        new PathInfo("testTag", OffsetDateTime.now()), null));
+        final Exchange exchange = new DefaultExchange(context);
+        configuration.setPosition(110L);
+        exchange.getIn().setHeader(DataLakeConstants.POSITION, 120L);
+
+        new DataLakeFileOperations(configuration, 
client).flushToFile(exchange);
+
+        verify(client).flushWithResponse(eq(120L), any(), any(), any(), any(), 
any());
+        verify(client, never()).getFileSize();
+    }
+
+    @Test
+    void testFlushUsesAbsoluteConfiguredPosition() {
+        configuration.setPosition(120L);
+        when(client.flushWithResponse(anyLong(), any(), any(), any(), any(), 
any()))
+                .thenReturn(new ResponseBase<>(
+                        null, 200, new HttpHeaders(),
+                        new PathInfo("testTag", OffsetDateTime.now()), null));
+
+        new DataLakeFileOperations(configuration, client).flushToFile(new 
DefaultExchange(context));
+
+        verify(client).flushWithResponse(eq(120L), any(), any(), any(), any(), 
any());
+        verify(client, never()).getFileSize();
+    }
+
+    @Test
+    void testFlushPreservesCurrentLengthFallbackWhenPositionIsAbsent() {
+        // Preserve the unchanged null-position fallback introduced by 
CAMEL-24159.
+        when(client.getFileSize()).thenReturn(100L);
+        when(client.flushWithResponse(anyLong(), any(), any(), any(), any(), 
any()))
+                .thenReturn(new ResponseBase<>(
+                        null, 200, new HttpHeaders(),
+                        new PathInfo("testTag", OffsetDateTime.now()), null));
+
+        new DataLakeFileOperations(configuration, client).flushToFile(new 
DefaultExchange(context));
+
+        verify(client).flushWithResponse(eq(100L), any(), any(), any(), any(), 
any());
+    }
+
     @Test
     void testDownloadToFileRejectsPathTraversalName() {
         // a file name is influenced by whoever writes to the file system and 
may contain ../ segments;
diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
index e214e81ac9f6..29602bae9015 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@@ -4591,6 +4591,14 @@ support it keep their existing projection. The `camel 
semantic audit --json` dis
 base64 and reports metadata instead. Use `--output=<new-file>` to export the 
full returned JSON,
 with `--include-input` for case/bulk requests that need captured input. 
Existing files are not overwritten.
 
+=== camel-azure-storage-datalake - flush position is the final file length
+
+The `flushToFile` operation now uses the `position` option or 
`CamelAzureStorageDataLakePosition` header
+as the absolute final file length, as documented. Previously, it added this 
value to the current file length.
+Routes that supplied only the number of appended bytes must now supply the 
total final length.
+For example, after appending 20 bytes to a 100-byte file, use `120` instead of 
`20`.
+When no position is supplied, the operation still uses the current committed 
file length.
+
 === camel-azure-storage-datalake - a listed file that cannot be got is skipped
 
 When the consumer lists the file system, a failure to get one of the listed 
files (for example access denied by the ACL
diff --git 
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AzureStorageDatalakeComponentBuilderFactory.java
 
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AzureStorageDatalakeComponentBuilderFactory.java
index 8d091950d2ca..e0ca97bf7163 100644
--- 
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AzureStorageDatalakeComponentBuilderFactory.java
+++ 
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/AzureStorageDatalakeComponentBuilderFactory.java
@@ -316,8 +316,8 @@ public interface 
AzureStorageDatalakeComponentBuilderFactory {
         }
     
         /**
-         * This parameter allows the caller to upload data in parallel and
-         * control the order in which it is appended to the file.
+         * The final length of the file, including previously committed data,
+         * used by flushToFile.
          * 
          * The option is a: &lt;code&gt;java.lang.Long&lt;/code&gt; type.
          * 
diff --git 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/DataLakeEndpointBuilderFactory.java
 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/DataLakeEndpointBuilderFactory.java
index 31c48c2a2935..0ea646a27c69 100644
--- 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/DataLakeEndpointBuilderFactory.java
+++ 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/DataLakeEndpointBuilderFactory.java
@@ -443,8 +443,8 @@ public interface DataLakeEndpointBuilderFactory {
             return this;
         }
         /**
-         * This parameter allows the caller to upload data in parallel and
-         * control the order in which it is appended to the file.
+         * The final length of the file, including previously committed data,
+         * used by flushToFile.
          * 
          * The option is a: <code>java.lang.Long</code> type.
          * 
@@ -458,8 +458,8 @@ public interface DataLakeEndpointBuilderFactory {
             return this;
         }
         /**
-         * This parameter allows the caller to upload data in parallel and
-         * control the order in which it is appended to the file.
+         * The final length of the file, including previously committed data,
+         * used by flushToFile.
          * 
          * The option will be converted to a <code>java.lang.Long</code> type.
          * 
@@ -1869,8 +1869,8 @@ public interface DataLakeEndpointBuilderFactory {
             return this;
         }
         /**
-         * This parameter allows the caller to upload data in parallel and
-         * control the order in which it is appended to the file.
+         * The final length of the file, including previously committed data,
+         * used by flushToFile.
          * 
          * The option is a: <code>java.lang.Long</code> type.
          * 
@@ -1884,8 +1884,8 @@ public interface DataLakeEndpointBuilderFactory {
             return this;
         }
         /**
-         * This parameter allows the caller to upload data in parallel and
-         * control the order in which it is appended to the file.
+         * The final length of the file, including previously committed data,
+         * used by flushToFile.
          * 
          * The option will be converted to a <code>java.lang.Long</code> type.
          * 
@@ -2731,8 +2731,8 @@ public interface DataLakeEndpointBuilderFactory {
             return this;
         }
         /**
-         * This parameter allows the caller to upload data in parallel and
-         * control the order in which it is appended to the file.
+         * The final length of the file, including previously committed data,
+         * used by flushToFile.
          * 
          * The option is a: <code>java.lang.Long</code> type.
          * 
@@ -2746,8 +2746,8 @@ public interface DataLakeEndpointBuilderFactory {
             return this;
         }
         /**
-         * This parameter allows the caller to upload data in parallel and
-         * control the order in which it is appended to the file.
+         * The final length of the file, including previously committed data,
+         * used by flushToFile.
          * 
          * The option will be converted to a <code>java.lang.Long</code> type.
          * 

Reply via email to