I need to have a schedule job to read list of file names from DB and them upload them to a ftp site. How do I do that in WSO2 ESB?
Thanks
Updates (7/19/16): Based on the suggestions given, I wrote a stored procedure to return all file names in a xml format. Now that I need to figure out how to parse this xml formatted result and they can be ftp using fileconnector. Please let me know if my approach is workable. Thank you so much for your help.
<proxy name="FileUpload2CDGPS" startOnLoad="true" trace="disable" transports="https http" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<sequence key="FileLookupSeq"/>
<sequence key="SendFile2VendorSeq"/>
<send/>
</inSequence>
<outSequence/>
<faultSequence>
<drop/>
</faultSequence>
</target>
</proxy>
<sequence name="FileLookupSeq" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<log description="LogMessage" level="custom">
<property name="message" value="Find CDR files to upload"/>
</log>
<dblookup description="Get CDR files to be upload">
<connection>
<pool>
<password>***</password>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://localhost:5432/esbcdrdb</url>
<user>***</user>
</pool>
</connection>
<statement>
<sql><![CDATA[SELECT * FROM find_cdr_file_to_upload(1)]]></sql>
<result name="xml_file" column="find_cdr_file_to_upload"/>
</statement>
</dblookup>
</sequence>
<sequence name="SendFile2VendorSeq" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<iterate attachPath="//files/files-set" description=""
expression="//files/files-set/file" preservePayload="true">
<target>
<sequence>
<property description="fileName"
expression="//files/files-set/file/name" name="fileName"
scope="default" type="STRING"/>
<property description="fileId"
expression="//files/files-set/file/id" name="fileId"
scope="default" type="STRING"/>
<property description="fileSource"
expression="//files/files-set/file/path" name="fileSource"
scope="default" type="STRING"/>
<property description="vendorId"
expression="//files/files-set/file/vendor-id" name="vendorId"
scope="default" type="STRING"/>
<property description="vendorDest"
expression="//files/files-set/file/vendor-dest"
name="vendorDest" scope="default" type="STRING"/>
<fileconnector.copy>
<source>{$ctx:fileSource}</source>
<destination>{$ctx:vendorDest}</destination>
<filePattern>{$ctx:fileName}</filePattern>
</fileconnector.copy>
</sequence>
</target>
</iterate>
</sequence>