[
https://issues.apache.org/jira/browse/CAMEL-19066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17690526#comment-17690526
]
Claus Ibsen commented on CAMEL-19066:
-------------------------------------
[~hgarus] would you add an unit test for enrich EIP also, and look at fixing
org.apache.camel.processor.Enrich is a similar way.
BTW you should only restore the correlation id if its != null.
> 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.18.5, 3.20.2
> Reporter: hgarus
> Assignee: Claus Ibsen
> Priority: Minor
>
> 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)