We will receive a large number of small xml files, we would like to combine all these files in only one xml file before processing it.
We tried to do this using Aggregate mediator, but it doesn't work because we don't use an iterate or a clone mediator.
Here is an example using a proxy that polls on a directory. When the proxy consumes 3 messages, the aggregator merges correctly the messages but we never get into the onComplete. The log message "inside onComplete" doesn't appear and the sequence "TestAggregateSend" is not executed.
<proxy name="TestAggregateProxyService" startOnLoad="false" transports="https http vfs" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<log level="full">
<property name="DEBUG" value="start inSequence"/>
</log>
<aggregate id="sa">
<correlateOn expression="//ABC"/>
<completeCondition timeout="60">
<messageCount max="3" min="-1"/>
</completeCondition>
<onComplete expression="//ABC" sequence="TestAggregateSend">
<log level="full">
<property name="DEBUG" value="inside onComplete"/>
</log>
</onComplete>
</aggregate>
<log level="full">
<property name="DEBUG" value="end inSequence"/>
</log>
</inSequence>
<outSequence>
<log level="full">
<property name="DEBUG" value="inside outSequence"/>
</log>
<sequence key="TestAggregateSend"/>
</outSequence>
<faultSequence/>
</target>
<parameter name="transport.PollInterval">5</parameter>
<parameter name="transport.vfs.FileURI">file:///var/wso2/test/in</parameter>
<parameter name="transport.vfs.ContentType">text/xml;charset=UTF-8</parameter>
<parameter name="transport.vfs.FileProcessInterval">1000</parameter>
<parameter name="transport.vfs.FileNamePattern">.*.xml</parameter>
According to logs, the merge works, but it is impossible to do any action in the onCompete
DEBUG {org.apache.synapse.mediators.eip.aggregator.AggregateMediator} - Merged result :
<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body>
<ABC>
<DEF>1</DEF>
<GHI>2</GHI>
</ABC>
<ABC>
<PQR>5</PQR>
<STU>6</STU></ABC>
<ABC>
<JKL>3</JKL>
<MNO>4</MNO></ABC>
Is it possible to merge multiple files using Aggregate mediator ? Is there any other way to merge xml files using WSO ESB ?
Aggregate mediator doesn't work when correlateOn is not empty in EI 6.1.1. Problem fixed in v2.1.7-wso2v16