Claus Ibsen created CAMEL-24880:
-----------------------------------

             Summary: camel-core - GroupedBodyAggregationStrategy's list prints 
as List<Exchange>(n elements) although it holds bodies
                 Key: CAMEL-24880
                 URL: https://issues.apache.org/jira/browse/CAMEL-24880
             Project: Camel
          Issue Type: Improvement
          Components: camel-core
            Reporter: Claus Ibsen
             Fix For: 4.23.0


{{GroupedBodyAggregationStrategy}} collects the message bodies of the 
aggregated exchanges into a list, but the list it builds is the 
{{GroupedExchangeList}} of {{AbstractListAggregationStrategy}}, whose 
{{toString()}} answers {{List<Exchange>(2 elements)}} whatever the elements 
are. So a route that aggregates with the grouped body strategy and logs 
{{${body}}} shows:

{noformat}
INFO ... aggregator.camel.yaml:43 : Shipment for ORD-1001 complete: 
List<Exchange>(2 elements)
{noformat}

while the body is a list of two Maps. The override exists so that a list of 
Exchanges is not printed in full, which is right for 
{{GroupedExchangeAggregationStrategy}}, and wrong for the body list: the 
elements are what the user aggregated and expects to see. The route/aggregator 
example's README says to log the shipment before marshalling it; a person 
following it, and the local model in the camel-jbang-mcp stepwise benchmark, 
see a line that says the body is a list of exchanges.

Use the plain list toString for {{GroupedBodyAggregationStrategy}} (and any 
subclass whose {{getValue}} is not the exchange), keeping the short form for 
the exchange list.



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

Reply via email to