Create dynamic file Name in mediation component cSplitter?

Highlighted
Five Stars

Create dynamic file Name in mediation component cSplitter?

Hi

I am new to Talend. I want to create a dynamic name for writing the files. The flow is like cFile is consuming Four files from the directory then aggregate to one File on the basis of the file name and in cProcessor again  get the list of file name and folllowed by csplitter and then again cfile genertaes 4 files with source file name and the body.

here is the code for cProcessor:

     

 

List<String> fileList = new ArrayList<String>();
fileList = (List<String>)exchange.getProperty("CamelFileName");
System.out.println("After aggregation the fileName: "+
fileList);

List<String> listBody = new ArrayList<String>();
listBody = (List<String>)exchange.getProperty("body");
System.out.println("After aggregation the body: "+ listBody);


 exchange.setProperty("FileName",fileList);

Tags (1)
Eight Stars

Re: Create dynamic file Name in mediation component cSplitter?

You should use a java bean and use a static list of string to store your filenames, then after the split, according to the message number (1,2,3 or 4) set it the name in the list (the correct header is CamelFileName)

What’s New for Talend Spring ’19

Join us live for a sneak peek!

Sign up now

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads