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 2023/07/31 09:58:01 UTC

[camel] branch uow-sc-enabled created (now 71a213b24a5)

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

davsclaus pushed a change to branch uow-sc-enabled
in repository https://gitbox.apache.org/repos/asf/camel.git


      at 71a213b24a5 CAMEL-19670: camel-core - UnitOfWork should not use stream caching in useOriginalMessage if not enabled.

This branch includes the following new commits:

     new 71a213b24a5 CAMEL-19670: camel-core - UnitOfWork should not use stream caching in useOriginalMessage if not enabled.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[camel] 01/01: CAMEL-19670: camel-core - UnitOfWork should not use stream caching in useOriginalMessage if not enabled.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch uow-sc-enabled
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 71a213b24a55271d85cb0eb203e9096fce9b7db0
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jul 31 11:57:43 2023 +0200

    CAMEL-19670: camel-core - UnitOfWork should not use stream caching in useOriginalMessage if not enabled.
---
 .../org/apache/camel/impl/engine/DefaultUnitOfWork.java     | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultUnitOfWork.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultUnitOfWork.java
index aa4e27cd806..002290086af 100644
--- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultUnitOfWork.java
+++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultUnitOfWork.java
@@ -34,6 +34,7 @@ import org.apache.camel.Processor;
 import org.apache.camel.Route;
 import org.apache.camel.StreamCache;
 import org.apache.camel.spi.InflightRepository;
+import org.apache.camel.spi.StreamCachingStrategy;
 import org.apache.camel.spi.Synchronization;
 import org.apache.camel.spi.SynchronizationVetoable;
 import org.apache.camel.spi.UnitOfWork;
@@ -50,6 +51,7 @@ public class DefaultUnitOfWork implements UnitOfWork {
 
     // instances used by MDCUnitOfWork
     final InflightRepository inflightRepository;
+    final StreamCachingStrategy streamCachingStrategy;
     final boolean allowUseOriginalMessage;
     final boolean useBreadcrumb;
 
@@ -79,6 +81,7 @@ public class DefaultUnitOfWork implements UnitOfWork {
         this.useBreadcrumb = useBreadcrumb;
         this.context = exchange.getContext();
         this.inflightRepository = inflightRepository;
+        this.streamCachingStrategy = exchange.getContext().getStreamCachingStrategy();
         doOnPrepare(exchange);
     }
 
@@ -102,10 +105,12 @@ public class DefaultUnitOfWork implements UnitOfWork {
 
         if (allowUseOriginalMessage) {
             this.originalInMessage = exchange.getIn().copy();
-            // if the input body is streaming we need to cache it, so we can access the original input message
-            StreamCache cache = context.getStreamCachingStrategy().cache(this.originalInMessage);
-            if (cache != null) {
-                this.originalInMessage.setBody(cache);
+            if (streamCachingStrategy.isEnabled()) {
+                // if the input body is streaming we need to cache it, so we can access the original input message
+                StreamCache cache = streamCachingStrategy.cache(this.originalInMessage);
+                if (cache != null) {
+                    this.originalInMessage.setBody(cache);
+                }
             }
         }