Frage

In Mule, I am downloading files from FTP server. I want to pass all the files in this directory to my java class which should be performing actions after Download_ZIP_File in my flow. I need to perform actions like reading text files and unzip the zipped files using Java.

There should be a Java class in my flow, for which a function call should be raised when download is complete.. Object of this class must know all the information about downloaded files.

Can someone please help on this.? Here is my current flow;

enter image description here

My XML for this flow is like this;

 <?xml version="1.0" encoding="UTF-8"?>

 <mule xmlns:ftp="http://www.mulesoft.org/schema/mule/ee/ftp"
        xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" 
        ... >
    <file:endpoint name="Download_File_KBB" responseTimeout="10000" doc:name="File" path="E:\csv\output"/>
    <file:connector name="Global_File_Connector" autoDelete="false" streaming="false" validateConnections="true" doc:name="File"/>
    <flow name="ftp_kbb_download_fileFlow1" doc:name="ftp_kbb_download_fileFlow1">
       <ftp:inbound-endpoint host="${ftp.host}" port="${ftp.port}" path="${ftp.pathInbound}" user="${ftp.user}" password="${ftp.password}" responseTimeout="10000" doc:name="KBB_FTP">
       </ftp:inbound-endpoint>
       <logger message="KBBUsedVehiclesNoSpecTabFormat-#[server.dateTime.year]-W#[server.dateTime.weekOfYear]" level="INFO" doc:name="Logger"/>
       <file:outbound-endpoint path="${file.inboundEndpoint}" outputPattern="#[header:originalFilename]" responseTimeout="10000" doc:name="Donwload_ZIP_FILE" connector-ref="Global_File_Connector"/>
    </flow>
  </mule>
War es hilfreich?

Lösung

One option is to create a class that implements org.mule.api.lifecycle.Callable then configure it with a component element in your config.

Then, you will have full access to the MuleEventContext in the onCall method of this Callable class.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top