August 15, 2023

cFile – Docs for ESB 6.x

cFile

Provides access to file systems, allowing files to be processed by any other
components or messages from other components to be saved to the disk.

cFile Standard properties

These properties are used to configure cFile running in the Standard Job framework.

The Standard
cFile component belongs to the Connectivity/File family.

Basic settings

Path

Path to the file or files to be accessed or saved.

Parameters/Noop

Select this check box to keep the file or files in the original
folder after being read.

Parameters/Flatten

Select this check box to flatten the file name path to strip any
leading paths. This allows you to consume recursively into
sub-directories, but when you, for example, write the files to
another directory, they will be written in a single directory.

Parameters/AutoCreate

Select this check box to create the directory specified
in the Path field automatically if it
does not exist.

Parameters/BufferSize(kb)

Write buffer sized in bytes.

Encoding Specify the encoding of the file, ISO-8859-15, UTF-8, or
CUSTOM.
FileName The name of the file to be processed. Use this option if
you want to consume only a single file in the specified
directory.

Advanced settings

Advanced Set the optional arguments in the corresponding table.
Click [+] as many times as required to
add arguments to the table. Then click the corresponding Value field and enter a value. See the site
http://camel.apache.org/file2.html for available URI
options.

Usage

Usage rule

cFile can be a start, middle or
end component in a Route.

Limitation

 n/a

Scenario: Reading files from one directory and writing them to another

This scenario applies only to a Talend solution with ESB.

In this scenario, an input cFile component is
configured to visit a local file directory and send the files in the directory to an
output cFile component which writes the files in
another directory.

use_case_cfile1.png

Dropping and linking the components

  1. From the Palette, expand the Connectivity/File folder and select the cFile component. Drop one as the input component
    and another as the output component onto the design workspace.
  2. Right-click the input cFile component,
    select Row > Route in the contextual menu and click the output cFile component.
  3. Label the components to better identify their respective
    functionality.

Configuring the components

  1. Double-click the input cFile component to
    display its Basic settings view in the
    Component tab.

    use_case_cfile2.png

  2. In the Path field, browse to or enter the
    input file path, and leave the other parameters as they are.
  3. Double-click the output cFile component to display its Basic
    settings
    view in the Component
    tab.

    use_case_cfile3.png

  4. In the Path field, browse to or enter the output file
    path, as shown above. Leave the other parameters as they are.
  5. Press Ctrl+S to save your route.

Viewing code and executing the Route

  1. Click the Code tab at the
    bottom of the design workspace to have a look at the generated code.

    use_case_cfile4.png

    As shown in the code, a message route is built from one endpoint .to
    another.
  2. Click the Run view to display it and
    click the Run button to launch the
    execution of your Route. You can also press F6 to execute it.

    RESULT: The input files are written to specified output directory.

Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x