You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/05/10 15:02:02 UTC

[camel-spring-boot] 01/02: CAMEL-18087: camel-core - Enable stream caching by default.

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-spring-boot.git

commit 37ef4ea5ebf6c933549944a9471b1e24f09793ee
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue May 10 16:09:00 2022 +0200

    CAMEL-18087: camel-core - Enable stream caching by default.
---
 core/camel-spring-boot/src/main/docs/spring-boot.json        |  4 ++--
 .../camel/spring/boot/CamelConfigurationProperties.java      | 12 ++++++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/core/camel-spring-boot/src/main/docs/spring-boot.json b/core/camel-spring-boot/src/main/docs/spring-boot.json
index 0281f35d803..cb39cba2cfc 100644
--- a/core/camel-spring-boot/src/main/docs/spring-boot.json
+++ b/core/camel-spring-boot/src/main/docs/spring-boot.json
@@ -1022,9 +1022,9 @@
     {
       "name": "camel.springboot.stream-caching-enabled",
       "type": "java.lang.Boolean",
-      "description": "Sets whether stream caching is enabled or not. Default is false.",
+      "description": "Sets whether stream caching is enabled or not. While stream types (like StreamSource, InputStream and Reader) are commonly used in messaging for performance reasons, they also have an important drawback: they can only be read once. In order to be able to work with message content multiple times, the stream needs to be cached. Streams are cached in memory. However, for large stream messages (over 128 KB by default) will be cached in a temporary file instead, and Came [...]
       "sourceType": "org.apache.camel.spring.boot.CamelConfigurationProperties",
-      "defaultValue": false
+      "defaultValue": true
     },
     {
       "name": "camel.springboot.stream-caching-remove-spool-directory-when-stopping",
diff --git a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java
index a3b7f932dbc..6ce4c9bea54 100644
--- a/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java
+++ b/core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelConfigurationProperties.java
@@ -277,9 +277,17 @@ public class CamelConfigurationProperties extends DefaultConfigurationProperties
     /**
      * Sets whether stream caching is enabled or not.
      *
-     * Default is false.
+     * While stream types (like StreamSource, InputStream and Reader) are commonly used in messaging for performance
+     * reasons, they also have an important drawback: they can only be read once. In order to be able to work with
+     * message content multiple times, the stream needs to be cached.
+     *
+     * Streams are cached in memory. However, for large stream messages (over 128 KB by default) will be cached in a
+     * temporary file instead, and Camel will handle deleting the temporary file once the cached stream is no longer
+     * necessary.
+     *
+     * Default is true.
      */
-    private boolean streamCachingEnabled;
+    private boolean streamCachingEnabled = true;
 
     /**
      * Sets the stream caching spool (temporary) directory to use for overflow and spooling to disk.