title: WSO2 Enterprise Integrator 6.3.0: how to merge mutliple files to one?
body: <p>I'm trying to create an integration scenario with WSO EI 6.3.0 and have the following scenario and do not get it working:</p>
  
  <ul>
  <li>I have a set of multiple CSV files holding related entities (let's say just two for the beginning, customers and orders) in folder "IN" written by system "A"</li>
  <li>At the end I want to create one XML having the CSV contents nested (e.g. having orders as children for the customers) in folder "OUT" to be read by system "B"</li>
  </ul>
  
  <p>I created a proxy reading the CSV files and pushing them to the inSequence. . What I tried:</p>
  
  <ul>
  <li>creating a clone mediator to send the file to some transformation sequences (one per CSV file type). Using the filter and smooks afterwards created a XML payload </li>
  <li>collect the messages in an aggregator and finally write them to file</li>
  </ul>
  
  <p>I'm reaching the aggregator step but I'm not stepping over it.</p>
  
  <p>What am I doing wrong? Or is this use case potentially not realizable with WSO2 EI?</p>
  
  <p>Find below my code. Thank you in advance for your support guys.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;proxy name="FileReaderProxy" startOnLoad="true" transports="vfs" xmlns="http://ws.apache.org/ns/synapse"&gt;
      &lt;target&gt;
          &lt;inSequence&gt;
              &lt;property name="AggregatedResponses" scope="default"&gt;
                  &lt;metasyst/&gt;
              &lt;/property&gt;
              &lt;property description="Get File Name" expression="$trp:FILE_NAME" name="fileName" scope="default" type="STRING"/&gt;
              &lt;log description="Enter In Sequence" level="full"&gt;
                  &lt;property name="Step" value="Enter In Sequence"/&gt;
                  &lt;property expression="get-property('fileName')" name="Filename : "/&gt;
              &lt;/log&gt;
              &lt;clone continueParent="true" id="csvFileSet"&gt;
                  &lt;target&gt;
                      &lt;sequence&gt;
                          &lt;property description="Get File Name" expression="$trp:FILE_NAME" name="fileName" scope="default" type="STRING"/&gt;
                          &lt;log description="Enter Order Clone Branch" level="full"&gt;
                              &lt;property name="Step" value="Enter Order Clone Branch"/&gt;
                              &lt;property expression="get-property('fileName')" name="Reading File : "/&gt;
                          &lt;/log&gt;
                          &lt;filter xpath="get-property('fileName')='auftraege.csv'"&gt;
                              &lt;then&gt;
                                  &lt;smooks config-key="conf:myresources/order-smooks-config.xml"&gt;
                                      &lt;input type="text"/&gt;
                                      &lt;output type="xml"/&gt;
                                  &lt;/smooks&gt;
                                  &lt;log description="Exit Order Clone Branch" level="full"&gt;
                                      &lt;property name="Step" value="Exit Order Clone Branch"/&gt;
                                  &lt;/log&gt;
                              &lt;/then&gt;
                              &lt;else&gt;
                                  &lt;log description="Drop Order Clone Branch" level="full"&gt;
                                      &lt;property name="Step" value="Drop Order Clone Branch"/&gt;
                                  &lt;/log&gt;
                                  &lt;drop/&gt;
                              &lt;/else&gt;
                          &lt;/filter&gt;
                      &lt;/sequence&gt;
                  &lt;/target&gt;
                  &lt;target&gt;
                      &lt;sequence&gt;
                          &lt;property description="Get File Name" expression="$trp:FILE_NAME" name="fileName" scope="default" type="STRING"/&gt;
                          &lt;log description="Enter Customer Clone Branch" level="full"&gt;
                              &lt;property name="Step" value="Enter Customer Clone Branch"/&gt;
                              &lt;property expression="get-property('fileName')" name="Reading File : "/&gt;
                          &lt;/log&gt;
                          &lt;filter xpath="get-property('fileName')='kunden.csv'"&gt;
                              &lt;then&gt;
                                  &lt;smooks config-key="conf:myresources/customer-smooks-config.xml"&gt;
                                      &lt;input type="text"/&gt;
                                      &lt;output type="xml"/&gt;
                                  &lt;/smooks&gt;
                                  &lt;log description="Exit Customer Clone Branch" level="full"&gt;
                                      &lt;property name="Step" value="Exit Customer Clone Branch"/&gt;
                                  &lt;/log&gt;
                              &lt;/then&gt;
                              &lt;else&gt;
                                  &lt;log description="Exit Customer Clone Branch" level="full"&gt;
                                      &lt;property name="Step" value="Exit Customer Clone Branch"/&gt;
                                  &lt;/log&gt;
                                  &lt;drop/&gt;
                              &lt;/else&gt;
                          &lt;/filter&gt;
                      &lt;/sequence&gt;
                  &lt;/target&gt;
              &lt;/clone&gt;
              &lt;log description="Enter aggregation" level="full"&gt;
                  &lt;property name="Step" value="Enter aggregation"/&gt;
              &lt;/log&gt;
              &lt;property name="AggregatedResponses" scope="default"&gt;
                  &lt;metasyst/&gt;
              &lt;/property&gt;
              &lt;aggregate id="csvFileSet"&gt;
                  &lt;completeCondition&gt;
                      &lt;messageCount max="-1" min="2"/&gt;
                  &lt;/completeCondition&gt;
                  &lt;onComplete enclosingElementProperty="AggregatedResponses" expression="$body/*[1]" xmlns:ns="http://org.apache.synapse/xsd"&gt;
                      &lt;log description="Start Output File Writing" level="full"&gt;
                          &lt;property name="Step" value="Start Output File Writing"/&gt;
                      &lt;/log&gt;
                      &lt;property description="OUT_ONLY" name="OUT_ONLY" scope="default" type="STRING" value="true"/&gt;
                      &lt;send&gt;
                          &lt;endpoint&gt;
                              &lt;address uri="vfs:file:///D:/Programme/WSO2-EI/Samples/files/4-out"/&gt;
                          &lt;/endpoint&gt;
                      &lt;/send&gt;
                  &lt;/onComplete&gt;
              &lt;/aggregate&gt;
          &lt;/inSequence&gt;
          &lt;outSequence/&gt;
          &lt;faultSequence&gt;
              &lt;drop/&gt;
          &lt;/faultSequence&gt;
      &lt;/target&gt;
      &lt;parameter name="transport.PollInterval"&gt;1&lt;/parameter&gt;
      &lt;parameter name="transport.vfs.FileURI"&gt;file:///D:/Programme/WSO2-EI/Samples/files/1-in&lt;/parameter&gt;
      &lt;parameter name="transport.vfs.ContentType"&gt;text/plain&lt;/parameter&gt;
      &lt;parameter name="transport.vfs.ActionAfterProcess"&gt;MOVE&lt;/parameter&gt;
      &lt;parameter name="transport.vfs.MoveAfterFailure"&gt;file:///D:/Programme/WSO2-EI/Samples/files/3-error&lt;/parameter&gt;
      &lt;parameter name="transport.vfs.ActionAfterFailure"&gt;MOVE&lt;/parameter&gt;
      &lt;parameter name="transport.vfs.FileNamePattern"&gt;.*.csv&lt;/parameter&gt;
      &lt;parameter name="transport.vfs.MoveAfterProcess"&gt;file:///D:/Programme/WSO2-EI/Samples/files/2-success&lt;/parameter&gt;
  &lt;/proxy&gt;
  </code></pre>