How to set directories and file names dynamically using File / FTP / SFTP reference bindings in FSW 6
Issue
- I have a Camel service that is writing to a shared file using a composite reference with SFTP binding.
- I am using environment properties for the host, port, username and password, but I cannot use any properties for the directory and file name as they are specific to the requests.
- What is the recommended way to dynamically set the directory and file name in an SFTP binding? The names are available in the Camel service.
- I am setting the property in my Camel service in a processor with:
exchange.getIn().setHeader(org.apache.camel.Exchange.FILE_NAME, fileName);
- I have also set the
ContextMapperto includeCamelFileNameheader in the SFTP binding with:
<ftp:binding.sftp ...>
<ftp:contextMapper includes="CamelFileName"/>
...
</ftp:binding.sftp>
- Yet, the sent file has the name
ID-xxxxx-40109-1403778042961-157-16. What have I omitted?
Environment
- Red Hat JBoss Fuse Service Works (FSW)
- 6.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
