August 19, 2017

Apache Camel FTP consumer

In this post I show how to implement a message consumer FTP with Apache Camel FTP Component.This component extends the File Component and provides access to remote file systems over the FTP and SFTP protocols. In this example I make use of the Java DSL to set up the FTP route in the ConsumerRouteBuilder class. The CamelContext adds the FTP route to the application context and starts the message exchanges. I use a Thread.sleep of 30 seconds to simulate a runtime environment for consuming messages. This article comes with the source code which is available online on my github repository camel-ftp-consumer. I’ve also included the console output after a test execution with Maven where a file on the remote FTP server is downloaded and copied into a local directory.


Stack

Apache Camel FTP 2.17.3
JDK 1.8
Maven 3.2

Source

SUBVERSION svn co https://github.com/giuseppeurso-eu/activemq/trunk activemq-samples GIT git clone https://github.com/giuseppeurso-eu/activemq

FTP Component dependency in pom.xml 

ConsumerRouteBuilder.java

CamelExecutor.java

Run test 

Related posts

Leave a Reply

Your email address will not be published.