apache-cameldslcamel-ftp

Changing directory from home to root in camel-ftp


I am using the following in my Apache Camel configuration:

<camel:route errorHandlerRef="loggingErrorHandler" id="ROUTE_ICL">

    <camel:from uri="file:{{camel.route.icl.from.file.path}}?filter=#fileFilterMAVRO&amp;initialDelay={{camel.route.from.file.initialDelay}}&amp;delay={{camel.route.from.file.delay}}&amp;useFixedDelay=true&amp;runLoggingLevel=TRACE&amp;startingDirectoryMustExist={{camel.route.from.file.startingDirectoryMustExist}}&amp;autoCreate={{camel.route.from.file.autoCreate}}&amp;maxMessagesPerPoll={{camel.route.from.file.maxMessagesPerPoll}}&amp;eagerMaxMessagesPerPoll=true&amp;delete=false&amp;readLock=idempotent&amp;readLockLoggingLevel=OFF&amp;readLockRemoveOnRollback=false&amp;readLockRemoveOnCommit=false&amp;idempotent=true&amp;idempotentKey=${file:onlyname}&amp;idempotentRepository=#iclMessageIdRepository&amp;recursive=false&amp;move={{camel.route.icl.complete.file.path}}&amp;moveFailed={{camel.route.icl.failed.file.path}}" />

    <camel:to uri="sftp://user1@ecomt199.qintra.com:22/nas/tst2/inputfiles?password=Pass1234&amp;runLoggingLevel=TRACE"/>

</camel:route>

Now, this is working. It is able to sftp my file.

Problem is I want my file to be at: /nas/tst2/inputfiles. But it is going at: /home/user1/nas/tst2/inputfiles

Now, how can I make it for going it at /nas/tst2/inputfiles? /nas/ and /home/ both are on <root>/.

The problem is changing this default /home/.

Which attribute can I use? I am not able to find or understand how to do it in Camel DSL.


Solution

  • Camel indeed doesn't allow fully qualified paths in the current version. However, as long as the user has the privileges, you could use a path like this as a workaround:

    ../../../../../../../../this_is_the_root_folder/usr/....
    

    You basically start with the user's directory and then go up in the tree until you reach root. You only need to make sure that you added enough ../../ to get to the root.

    It is not the nicest solution, but it is simple and worked for me.