2014-09-29 18 views

回答

2

您實際上不能從聚合器返回多個交換。

但是,您可以根據您提及的情況,讓您的聚合器將所有CSV記錄返回Collection,然後route將它們轉換爲三條不同的路線。

如果您願意,您可以在每條路線上彙總過濾的CSV記錄。

<route id="mainRoute"> 
    <from ... /> 
    <!-- this is you aggregator that aggregates the two CSV files' records --> 
    <aggregate strategyRef="aggregatorStrategy"> 
     ... 
     <!-- split the resulting records (aggregator returned an exchange with a List body)--> 
     <split> 
      <simple>${body}</simple> 
      <choice> 
       <when> 
        <!-- your condition here --> 

        <!-- send to the first category route --> 
        <to uri="direct:firstCategoryRecords" /> 
       </when> 
       <when> 
        <!-- your condition here --> 

        <!-- send to the second category route --> 
        <to uri="direct:secondCategoryRecords" /> 
       </when> 
       <!-- same for third category --> 
       ... 
      </choice> 
     </split> 
    </aggregate> 
</route> 

<route id="firstCategoryRecordsRoute"> 
    <from uri="direct:firstCategoryRecords" /> 
    <!-- aggregate the filtered CSV records into one file here --> 
    ... 
</route> 

<!-- rest of the routes --> 
... 
+0

謝謝。 @Ahmad Y. Saleh。 – sekhar 2014-09-29 06:10:21