cfile read mode in talend route

Five Stars

cfile read mode in talend route

hi i have a problem and i need help please, first we start with the screenshoots and after i will explain my problem.2018-01-19_12h15_22.png2018-01-19_12h17_10.png

so my job is for exctracting from a file lines containing link to another files, to do that i used csplitter and cprocessor, and after getting lines of that file. i want to read or move those files with the second cfile but the problem with the second cfile istead of read the files it writes in those files the body of the first cfile.

second question i want to know if it's possible to pass to the parameter path of cfile a var like "${in.header.path}" 

thanks a lot


Accepted Solutions
Community Manager

Re: cfile read mode in talend route

In which case you will need to identify what you want to do in a cProcessor and set a header for each message (each message after the splitter) to identify what you want to do (read or move). The you will have to use a cRecipientList to pass the message to the required messaging endpoint to read or move the file.

 

This will be a lot harder to implement than using a cTalendJob, but it is possible.

 

This might be of use: http://people.apache.org/~dkulp/camel/file2.html

View solution in original post

Community Manager

Re: cfile read mode in talend route

I'm not sure move will be as easy as that. I think you *may* have to read the contents of the file to a new file (in your new location) and then subsequently delete the source file.

View solution in original post


All Replies
Community Manager

Re: cfile read mode in talend route

You need to do this in a different way. The cFile components are behaving in exactly the way they are supposed to. Your consumer cFile (the one at the beginning) is reading as you would expect. The producer cFile (the ones at the end) is writing content. If you want to read and move (or read or move) files by the data received from a file, you might want to try using a cTalendJob component and writing a Talend job to do this. This will be far easier.

Five Stars

Re: cfile read mode in talend route

thanks for you response but i can't use ctalendJob i want just to use only Talend Route by the way thanks for your help
Community Manager

Re: cfile read mode in talend route

In which case you will need to identify what you want to do in a cProcessor and set a header for each message (each message after the splitter) to identify what you want to do (read or move). The you will have to use a cRecipientList to pass the message to the required messaging endpoint to read or move the file.

 

This will be a lot harder to implement than using a cTalendJob, but it is possible.

 

This might be of use: http://people.apache.org/~dkulp/camel/file2.html

View solution in original post

Five Stars

Re: cfile read mode in talend route

thanks a lot Rhall,
just last question to specify move type in the endpoind i should add a parameter in advanced settings of the Cfile with name "move" and value "true" or what
thanks
Community Manager

Re: cfile read mode in talend route

I'm not sure move will be as easy as that. I think you *may* have to read the contents of the file to a new file (in your new location) and then subsequently delete the source file.

View solution in original post

Five Stars

Re: cfile read mode in talend route

that's i did last week and it works fine, also another solution is that we can move files using java code.

thanks a lot rhall and have a nice day.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

An API-First Approach to Modernizing Applications

Learn how to use an API-First Approach to Modernize your Applications

Watch Now