title: How to define an Aggregator in Camel after using a ProducerTemplate?
body: <p>I have a route that processes csv files and inserts them as records into the database. Since it's a huge csv-file and the Camel csv-splitter ran out of memory we had to write our own splitter. I wrote the splitter using a ProducerTemplate.</p>
  
  <p>The route to process the csv looks a bit like this:</p>
  
  <pre><code>&lt;route id="processCsvRoute"&gt;
      &lt;from ref="inbox" /&gt;
      &lt;to uri="bean:csvBean?method=process"/&gt;
  &lt;/route&gt;
  </code></pre>
  
  <p>In the csvBean we do the splitting and finally execute the following java code for every csv-line (a csv line results in a product object).</p>
  
  <pre><code>producer.sendBodyAndHeader("direct:csvAggregator", product, "ID", csv.getFilename());
  </code></pre>
  
  <p>No the csvAggregator-route picks up the csv:</p>
  
  <pre><code>&lt;route id="csvAggregator"&gt;
  &lt;from uri="direct:csvAggregator" /&gt;
  &lt;aggregate strategyRef="exchangeAggregatorStrategy"
                 completionSize="10000"
                 completionInterval="10000"
                 parallelProcessing="true"&gt;
          &lt;correlationExpression&gt;
              &lt;header&gt;ID&lt;/header&gt;
          &lt;/correlationExpression&gt;
          &lt;to uri="bean:batchInsertBean"/&gt;
      &lt;/aggregate&gt;
  &lt;/route&gt;
  </code></pre>
  
  <p>Is there a way to define the aggregator in the processCsvRoute? My solution is working, but it doesn't feel right I have to create a separate route for it.</p>
  
  <p>Thanks for your help.</p>