Skip to main content

Create a Camel route

A Camel route can be seen as an application that receives an input file and then transforms or processes the file before it is passed on to a folder or an application.

For example, a Camel route task can be to:

  • Move a file to and from an FTP/SFTP.

  • Move a file within FA.

  • Transform and move a file to its destination.

For more information about processing files in Camel routes, visit Apache Camel site

Example of a Camel route

The route configuration below moves all files starting with "Positions" from the source directory to the end destination.

<routes xmlns="http://camel.apache.org/schema/spring">
    <route id="MoveReconFile">
    	<from uri="file:{{back.writable.dir}}/Input/?antInclude=Positions*&amp;readLock=changed&amp;readLockCheckInterval=5000&amp;move=.done/${file:name.noext}-${date:now:yyyyMMdd}.${file:ext}&amp;moveFailed=.failed" />
		<to uri="file:{{back.writable.dir}}/Output/Reconciliation/Import/Processed"/>
	</route>
</routes>

Camel route XML tags

Tag

Description

<routes> and <route>

The XML-based camel route definition is wrapped in the routes tag. There can be multiple route-tags withings the routes-tag.

<from>

Camel route source directory. The <from> block can contain more parameters inside. 

<to>

Camel route end destination.

Endpoint URI parameters

URI parameter

Description

file:directoryName

Source directory.

antInclude 

Include files that contain a certain string in the file name.

readLock 

Ensure that the file is not used or being written to by any other process.

readLockCheckInterval 

Set the interval in milliseconds between attempts to acquire the read lock.

move

Define the directory and the name of the file after it has been processed. 

moveFailed 

Define the directory and the name of the file if processing fails.