camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dusausoy <>
Subject Route design
Date Sat, 11 May 2013 07:34:48 GMT

I've set up a simple sandbox project[1] which polls a directory for 
files, sends them via ftp to a specific input directory. Then I wait for 
the server to transform the files. In the end I fetch them from another 
specific directory on the ftp server.

Basically my route is defined as is :

   .log("End route");

ftpSender and ftpReceiver are Spring beans :

public class FtpSender {

     private final FtpProperties ftpProperties;

     ProducerTemplate producerTemplate;

     public FtpSender(FtpProperties ftpProperties) {
         this.ftpProperties = ftpProperties;

     public String send(File file) throws InterruptedException {
         String fileName = file.getName();
         String uri = createInputFtpUri(fileName);
         producerTemplate.sendBody(uri, file);
         return fileName;

     private String createInputFtpUri(String filename) {
         StringBuilder builder = new StringBuilder("ftp://")

         return builder.toString();

My question is quite simple : is there a cleaner way to code this ?
I don't really like the route builder with the bean() method, I would 
like to use to() with URI's and some expression language or script.


Bruno Dusausoy
Software Engineer
YP5 Software
Pensez environnement : limitez l'impression de ce mail.
Please don't print this e-mail unless you really need to.

View raw message