Apache Camel file upload directory is getting duplicated

49 views Asked by At
final String sftpEndpoint = "sftp://{{sftp.write.host}}" + ":" + "{{sftp.write.port}}"
                + "{{sftp.write.folder}}"
                + "?username={{sftp.write.user}}" + "&privateKey=#sftpPrivateKey"
                + "&throwExceptionOnConnectFailed=true" + "&fileExist=Override" + "&disconnect=false";
from("direct:send.xml.to.sftp").routeId("direct.ipubr-send-xml-to-sftp")
          .setBody(exchangeProperty("pbol-xmldata"))
          .setHeader(Exchange.FILE_NAME, exchangeProperty("pbol-sftp-filename"))
          .setProperty(CommonConstants.FEI_LOG_MESSAGE_PROP, simple("Sending ${exchangeProperty.pbol-prod-location-items.size()} products to  file ${exchangeProperty.pbol-sftp-filename} to sftp."))
          .marshal().zipFile()
          .toD(sftpEndpoint)
        .end();

This is the code that i use to upload the files but and folder structure specified is /uploads/data/files but the files are getting created in /uploads/data/files/uploads/data/files.

1

There are 1 answers

1
Jeremy Ross On

Your ftp server is probably defaulting you into /uploads/data/files, then you're specifying /uploads/data/files in addition to that.

You can try enabling logging of org.apache.camel.component.file.remote to see what's happening.