title: How to use Apache Camel aggregator
body: <p>I have a very simple use case in which I want to put together a collection of stings and trying to use aggregator EIP for this. However when trying to start up the route it complains it cannot find an Aggregator Strategy:</p>
  
  <pre><code>java.lang.IllegalArgumentException: AggregationStrategy or AggregationStrategyRef must be set on Aggregate
  </code></pre>
  
  <p>below is how I can reproduce the issue:</p>
  
  <pre><code>import org.apache.camel.RoutesBuilder;
  import org.apache.camel.builder.RouteBuilder;
  import org.apache.camel.test.junit4.CamelTestSupport;
  import org.junit.Test;
  
  import java.util.Arrays;
  import java.util.List;
  
  public class AggregatorTest extends CamelTestSupport {
      private static final List&lt;String&gt; LIST = Arrays.asList(new String[] {"one", "two", "three"});
      @Override
      protected RoutesBuilder createRouteBuilder() throws Exception {
          return new RouteBuilder() {
              @Override
              public void configure() throws Exception {
                  from("direct:start")
                          .split().body()
                          .setHeader("cheese", constant("camembert"))
                          .aggregate(constant("all"))
                          .to("mock:end");
              }
          };
      }
  
      @Test
      public void shouldAggregateStrings() throws Exception {
          sendBody("direct:start", LIST);
      }
  }
  </code></pre>
  
  <p>Of course a very easy way to fix this would be to create an Aggregation Strategy implementation and configure my route to use it. However I would like to understand why the way is set up now does not work. According to the camel documentation on <a href="http://camel.apache.org/aggregator.html" rel="nofollow noreferrer">here</a> : </p>
  
  <blockquote>
    <p>By default Camel uses DefaultAggregationCollection and
    UseLatestAggregationStrategy, so this simple example will just keep
    the latest received exchange for the given correlation Expression</p>
  </blockquote>
  
  <p>I also noticed DefaultAggregationCollection is no longer part of the camel core. So what I am missing here?</p>