hgarus created CAMEL-19066:
------------------------------

             Summary: Multicast EIP sets correlationId on original Exchange
                 Key: CAMEL-19066
                 URL: https://issues.apache.org/jira/browse/CAMEL-19066
             Project: Camel
          Issue Type: Bug
          Components: came-core
    Affects Versions: 3.20.2, 3.18.5
            Reporter: hgarus


When copying the result onto the original Exchange the Multicast EIP and 
related EIPs like Split and RecipientList copy the result back to the original 
Exchange, this copy includes the correlationId of the subexchange.

This can be somewhat confusing, especially with FlexibleAggregationStrategy 
which aggregates the result in an Exchange which is correlated to a different 
Exchange than the original Exchange.

Example:
{code:java}
from("direct:foo")
    .log("Before split: exchangeId:'${exchangeId}' 
CorrelationId:'${exchangeProperty.CamelCorrelationId}'")
    .split(body(), 
AggregationStrategies.flexible().pick(body()).accumulateInCollection(ArrayList.class))
    .log("In split: exchangeId:'${exchangeId}' 
CorrelationId:'${exchangeProperty.CamelCorrelationId}'")
    .end()
    .log("After split: exchangeId:'${exchangeId}' 
CorrelationId:'${exchangeProperty.CamelCorrelationId}'"); {code}
Which produces the following Logging output for a two-Element List:
{code:java}
Before split: exchangeId:'742F0530A58A761-0000000000000000' CorrelationId:''
In split: exchangeId:'742F0530A58A761-0000000000000001' 
CorrelationId:'742F0530A58A761-0000000000000000'
In split: exchangeId:'742F0530A58A761-0000000000000002' 
CorrelationId:'742F0530A58A761-0000000000000000'
In split: exchangeId:'742F0530A58A761-0000000000000003' 
CorrelationId:'742F0530A58A761-0000000000000000'
After split: exchangeId:'742F0530A58A761-0000000000000000' 
CorrelationId:'742F0530A58A761-0000000000000001' {code}



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

Reply via email to