How to set directories and file names dynamically using File / FTP / SFTP reference bindings in FSW 6

Solution Verified - Updated -

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 ContextMapper to include CamelFileName header 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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content