Federico Mariani created CAMEL-23299:
----------------------------------------

             Summary: Aggregated exchange does not preserve the transacted flag 
from the original exchange
                 Key: CAMEL-23299
                 URL: https://issues.apache.org/jira/browse/CAMEL-23299
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 4.19.0
            Reporter: Federico Mariani


While working on https://issues.apache.org/jira/browse/CAMEL-23281 I noticed 
the following

_AggregateProcessor.doProcess()_ creates a correlated copy of the incoming 
exchange:

https://github.com/apache/camel/blob/main/core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java#L399

_Exchange.copy()_ does not preserve the transacted flag (it lives in 
ExtendedExchangeExtension which is created fresh for each instance). This means 
the aggregated exchange always has isTransacted() == false, even when the 
original exchange is transacted.

The Splitter handles this correctly by explicitly propagating the flag after 
copying:

https://github.com/apache/camel/blob/main/core/camel-core-processor/src/main/java/org/apache/camel/processor/Splitter.java#L216

The _AggregateProcessor_ does not do this. As a consequence, the 
_isTransacted()_ check added in _CAMEL-22147_ in _onSubmitCompletion()_ is 
effectively dead code, the transacted branch is never taken for the aggregated 
exchange.

I think this should be aligned with how the Splitter propagates the flag, but 
requires some testing and knowledge.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to