tree: 79cc348a43c343d953e51d05b46bbe72ced96bb8 [path history] [tgz]
  1. src/
  2. pom.xml
  3. README.md
examples/ftp/README.md

FTP Input Operator Example

This example shows how to use FTPStringInputOperator which is inherited from the AbstractFTPInputOperator. The FTPStringInputOperator scans a directory from an FTP server for files, reads lines from the files and emits them on the output port for further processing. The tuples emitted by the FTPStringInputOperator are processed by the downstream operator StringFileOutputOperator which writes them to hdfs.

The properties file META-INF/properties.xml shows how to configure the respective operators.

Users can choose the application and additional configuration file to use during launch time. In this example, we use the files mentioned above to configure the operator properties.

Update Properties from properties.xml - This is needed to run the example:

  • Update these common properties in the file /src/main/resources/META-INF/properties.xml:
Property NameDescription
dt.application.FTPInputExample.operator.Reader.hostaddress of the ftp server
dt.application.FTPInputExample.operator.Reader.userNameuser for the ftp server if anonymous ftp is disabled
dt.application.FTPInputExample.operator.Reader.passwordpassword associated with the above user
dt.application.FTPInputExample.operator.Writer.filePathoutput file path for the records after formatting
dt.application.FTPInputExample.operator.Writer.outputFileNameoutput file name for the records to be written after formatting

How to compile

shell> mvn clean package

This will generate application package malhar-examples-ftp-3.8.0-SNAPSHOT.apa inside target directory.

How to run

Use the application package generated above to launch the application from UI console(if available) or apex command line interface.

apex> launch target/malhar-examples-ftp-3.8.0-SNAPSHOT.apa

In case you have issues configuring the operator or running the application, please send an email to users@apache.apex.org.