Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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.0683p000009LrgY.png0683p000009Ls34.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

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

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

6 Replies
Anonymous
Not applicable
Author

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.

Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

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

Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

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.

Anonymous
Not applicable
Author

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.