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 4a358695093b CAMEL-24094: Deprecate dead forceWrites option on File
endpoint
4a358695093b is described below
commit 4a358695093b375fa2c78ad972f37c64c7f34152
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Jul 16 09:43:52 2026 +0200
CAMEL-24094: Deprecate dead forceWrites option on File endpoint
The forceWrites option has had no effect since Camel 2.20 when file
writing was refactored to use java.nio.file.Files.move()/copy().
Deprecate the option and change its default from true to false to
reflect the actual behavior.
Closes #24749
Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
.../resources/org/apache/camel/catalog/components/file.json | 2 +-
.../META-INF/org/apache/camel/component/file/file.json | 2 +-
.../java/org/apache/camel/component/file/FileEndpoint.java | 12 ++++++++++--
.../modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc | 10 ++++++++++
.../builder/endpoint/dsl/FileEndpointBuilderFactory.java | 6 ++++--
5 files changed, 26 insertions(+), 6 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/file.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/file.json
index 942c55647425..590cc7157963 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/file.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/file.json
@@ -89,7 +89,7 @@
"chmod": { "index": 36, "kind": "parameter", "displayName": "Chmod",
"group": "producer (advanced)", "label": "producer,advanced", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "Specify the file
permissions that are sent by the producer, the chmod value must be between 000
and 777; If there is a leading digit like in 0755, we will ignore it." },
"chmodDirectory": { "index": 37, "kind": "parameter", "displayName":
"Chmod Directory", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "Specify the directory permissions used when the producer
creates missing directories, the chmod value must be between 000 and 777; If
there is a leading digit like in 0755, we will ignore it." },
"eagerDeleteTargetFile": { "index": 38, "kind": "parameter",
"displayName": "Eager Delete Target File", "group": "producer (advanced)",
"label": "producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "description": "Whether or not to eagerly delete any
existing target file. This option only applies when you use fileExists=Override
and the tempFileName option as well. You can use [...]
- "forceWrites": { "index": 39, "kind": "parameter", "displayName": "Force
Writes", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": true,
"description": "Whether to force syncing, writes to the file system. You can
turn this off if you do not want this level of guarantee, for example, if
writing to logs \/ audit logs etc.; this would yield [...]
+ "forceWrites": { "index": 39, "kind": "parameter", "displayName": "Force
Writes", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
true, "autowired": false, "secret": false, "defaultValue": false,
"description": "Whether to force syncing, writes to the file system. You can
turn this off if you do not want this level of guarantee, for example, if
writing to logs \/ audit logs etc.; this would yield [...]
"keepLastModified": { "index": 40, "kind": "parameter", "displayName":
"Keep Last Modified", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Will keep the last modified timestamp
from the source file (if any). Will use the FileConstants.FILE_LAST_MODIFIED
header to located the timestamp. This header can contain eit [...]
"lazyStartProducer": { "index": 41, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produ [...]
"moveExistingFileStrategy": { "index": 42, "kind": "parameter",
"displayName": "Move Existing File Strategy", "group": "producer (advanced)",
"label": "producer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.component.file.strategy.FileMoveExistingStrategy",
"deprecated": false, "autowired": false, "secret": false, "description":
"Strategy (Custom Strategy) used to move file with special naming token to use
when fileExist=Move is configured. By default, [...]
diff --git
a/components/camel-file/src/generated/resources/META-INF/org/apache/camel/component/file/file.json
b/components/camel-file/src/generated/resources/META-INF/org/apache/camel/component/file/file.json
index 942c55647425..590cc7157963 100644
---
a/components/camel-file/src/generated/resources/META-INF/org/apache/camel/component/file/file.json
+++
b/components/camel-file/src/generated/resources/META-INF/org/apache/camel/component/file/file.json
@@ -89,7 +89,7 @@
"chmod": { "index": 36, "kind": "parameter", "displayName": "Chmod",
"group": "producer (advanced)", "label": "producer,advanced", "required":
false, "type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "Specify the file
permissions that are sent by the producer, the chmod value must be between 000
and 777; If there is a leading digit like in 0755, we will ignore it." },
"chmodDirectory": { "index": 37, "kind": "parameter", "displayName":
"Chmod Directory", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "Specify the directory permissions used when the producer
creates missing directories, the chmod value must be between 000 and 777; If
there is a leading digit like in 0755, we will ignore it." },
"eagerDeleteTargetFile": { "index": 38, "kind": "parameter",
"displayName": "Eager Delete Target File", "group": "producer (advanced)",
"label": "producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "description": "Whether or not to eagerly delete any
existing target file. This option only applies when you use fileExists=Override
and the tempFileName option as well. You can use [...]
- "forceWrites": { "index": 39, "kind": "parameter", "displayName": "Force
Writes", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": true,
"description": "Whether to force syncing, writes to the file system. You can
turn this off if you do not want this level of guarantee, for example, if
writing to logs \/ audit logs etc.; this would yield [...]
+ "forceWrites": { "index": 39, "kind": "parameter", "displayName": "Force
Writes", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
true, "autowired": false, "secret": false, "defaultValue": false,
"description": "Whether to force syncing, writes to the file system. You can
turn this off if you do not want this level of guarantee, for example, if
writing to logs \/ audit logs etc.; this would yield [...]
"keepLastModified": { "index": 40, "kind": "parameter", "displayName":
"Keep Last Modified", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Will keep the last modified timestamp
from the source file (if any). Will use the FileConstants.FILE_LAST_MODIFIED
header to located the timestamp. This header can contain eit [...]
"lazyStartProducer": { "index": 41, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produ [...]
"moveExistingFileStrategy": { "index": 42, "kind": "parameter",
"displayName": "Move Existing File Strategy", "group": "producer (advanced)",
"label": "producer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.component.file.strategy.FileMoveExistingStrategy",
"deprecated": false, "autowired": false, "secret": false, "description":
"Strategy (Custom Strategy) used to move file with special naming token to use
when fileExist=Move is configured. By default, [...]
diff --git
a/components/camel-file/src/main/java/org/apache/camel/component/file/FileEndpoint.java
b/components/camel-file/src/main/java/org/apache/camel/component/file/FileEndpoint.java
index 10223271a330..5c78164127b9 100644
---
a/components/camel-file/src/main/java/org/apache/camel/component/file/FileEndpoint.java
+++
b/components/camel-file/src/main/java/org/apache/camel/component/file/FileEndpoint.java
@@ -81,8 +81,9 @@ public class FileEndpoint extends GenericFileEndpoint<File> {
private boolean probeContentType;
@UriParam(label = "consumer,advanced")
private String extendedAttributes;
- @UriParam(label = "producer,advanced", defaultValue = "true")
- private boolean forceWrites = true;
+ @Deprecated
+ @UriParam(label = "producer,advanced", defaultValue = "false")
+ private boolean forceWrites;
@UriParam(label = "producer,advanced")
private String chmod;
@UriParam(label = "producer,advanced")
@@ -358,6 +359,10 @@ public class FileEndpoint extends
GenericFileEndpoint<File> {
this.directoryMustExist = directoryMustExist;
}
+ /**
+ * @deprecated This option has had no effect since Camel 2.20 and will be
removed in a future release.
+ */
+ @Deprecated
public boolean isForceWrites() {
return forceWrites;
}
@@ -365,7 +370,10 @@ public class FileEndpoint extends
GenericFileEndpoint<File> {
/**
* Whether to force syncing, writes to the file system. You can turn this
off if you do not want this level of
* guarantee, for example, if writing to logs / audit logs etc.; this
would yield better performance.
+ *
+ * @deprecated This option has had no effect since Camel 2.20 and will be
removed in a future release.
*/
+ @Deprecated
public void setForceWrites(boolean forceWrites) {
this.forceWrites = forceWrites;
}
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc
index 1ee310b3e89f..c1a87fbac224 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_22.adoc
@@ -207,6 +207,16 @@ The pre-sort is applied on the raw file listing before any
filtering or eager li
to combine `preSort=modified` with `eagerMaxMessagesPerPoll=true` and
`maxMessagesPerPoll=10` to efficiently
consume the 10 oldest files without creating Exchange objects for every file
on the server.
+=== camel-file - forceWrites option deprecated
+
+The `forceWrites` producer option on the File endpoint has been deprecated.
This option has had no effect
+since Camel 2.20, when the file-writing implementation was refactored to use
`java.nio.file.Files.move()`
+and `Files.copy()` instead of `FileChannel`-based streaming. The `forceWrites`
flag was intended to call
+`FileChannel.force(true)` (fsync) after writing, but no write path has invoked
it for several major versions.
+
+The default value has been changed from `true` to `false` to reflect the
actual behavior. The option will
+be removed in a future release.
+
=== camel-mail - MimeMultipartDataFormat inbound header filtering
When unmarshalling a MIME message with `headersInline=true`, the
`mime-multipart` data format now applies a
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/FileEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/FileEndpointBuilderFactory.java
index 08c182c729fb..a6e85685ee54 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/FileEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/FileEndpointBuilderFactory.java
@@ -3253,12 +3253,13 @@ public interface FileEndpointBuilderFactory {
*
* The option is a: <code>boolean</code> type.
*
- * Default: true
+ * Default: false
* Group: producer (advanced)
*
* @param forceWrites the value to set
* @return the dsl builder
*/
+ @Deprecated
default AdvancedFileEndpointProducerBuilder forceWrites(boolean
forceWrites) {
doSetProperty("forceWrites", forceWrites);
return this;
@@ -3271,12 +3272,13 @@ public interface FileEndpointBuilderFactory {
*
* The option will be converted to a <code>boolean</code> type.
*
- * Default: true
+ * Default: false
* Group: producer (advanced)
*
* @param forceWrites the value to set
* @return the dsl builder
*/
+ @Deprecated
default AdvancedFileEndpointProducerBuilder forceWrites(String
forceWrites) {
doSetProperty("forceWrites", forceWrites);
return this;