Tholgue opened a new pull request, #23949:
URL: https://github.com/apache/camel/pull/23949
# Description
Since the CAMEL-20302 refactoring (Camel 4.4.0), the `dynamic-router`
component uses a private
`NoopAggregationStrategy` as its default aggregation strategy, which keeps
the **first** recipient's
result. Both the `aggregationStrategy` option documentation ("By default,
Camel will use the last
reply as the outgoing message.") and the javadoc of
`DynamicRouterRecipientListHelper#createAggregationStrategy` ("If all else
fails, then a
`UseLatestAggregationStrategy` is used.") still describe the pre-4.4
behavior — and the stale
`UseLatestAggregationStrategy` import was still present, suggesting the
change was unintentional.
Practical impact: in `recipientMode=allMatch`, modifications made by any
recipient other than the
first one (message body, exchange properties) are silently discarded when
the exchange returns to
the calling route, so a `choice()` testing a property set by a subscriber
behaves differently
depending on subscription priorities.
This PR restores `UseLatestAggregationStrategy` as the default, matching the
documentation and the
pre-4.4 behavior (`DynamicRouterEndpoint#determineAggregationStrategy` in
4.3.0):
- `DynamicRouterRecipientListHelper`: fallback changed from
`NoopAggregationStrategy` to
`UseLatestAggregationStrategy`; `NoopAggregationStrategy` is kept but
`@Deprecated` to avoid
breaking binary compatibility on LTS backports.
- `DynamicRouterRecipientListHelperTest`: the fallback test now asserts
`UseLatestAggregationStrategy`.
- New `DynamicRouterDefaultAggregationIT`: end-to-end reproducer pinning the
documented behavior
(two matching recipients in allMatch mode; the last recipient's body and
exchange property must be
visible in the calling route). This test fails before the fix and passes
after.
Fixes [CAMEL-23735](https://issues.apache.org/jira/browse/CAMEL-23735).
Since the regression is in
4.4.0 and later, a backport to the active LTS branches (e.g. camel-4.14.x)
would be appreciated.
# Target
- [x] I checked that the commit is targeting the correct branch (Camel 4
uses the `main` branch)
# Tracking
- [x] If this is a large change, bug fix, or code improvement, I checked
there is a
[JIRA issue](https://issues.apache.org/jira/browse/CAMEL-23735) filed for
the change
# Apache Camel coding standards and style
- [x] I checked that each commit in the pull request has a meaningful
subject line and body.
- [x] I have run `mvn clean install -DskipTests` locally from root folder
and I have committed all
auto-generated changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]