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

2 ACCEPTED SOLUTIONS

Accepted Solutions
Thirteen Stars

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

Rilhia Solutions
Thirteen Stars

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.

Rilhia Solutions
6 REPLIES
Thirteen Stars

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.

Rilhia Solutions
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
Thirteen Stars

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

Rilhia Solutions
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
Thirteen Stars

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.

Rilhia Solutions
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.