Configuring the components and connections

SetHeader - Mediation

author
Talend Documentation Team
EnrichVersion
6.5
EnrichProdName
Talend Data Services Platform
Talend Data Fabric
Talend MDM Platform
Talend Real-Time Big Data Platform
Talend Open Studio for ESB
Talend ESB
task
Data Governance > Third-party systems > Processing components (Mediation) > SetHeader components (Mediation)
Design and Development > Third-party systems > Processing components (Mediation) > SetHeader components (Mediation)
Data Quality and Preparation > Third-party systems > Processing components (Mediation) > SetHeader components (Mediation)
EnrichPlatform
Talend Studio

Procedure

  1. Double-click the cFile component labeled Sender to display its Basic settings view in the Component tab.
  2. In the Path field, fill in or browse to the path to the folder that holds the source files.
    From the Encoding list, select the encoding type of your source files.
    In the FileName field, type in the file name of the source message. You can skip this step if the source folder contains only one file.
  3. Repeat steps 1 and 2 above to define the output file path and encoding type in the Basic settings view of the other cFile component, which is labeled Receiver. Leave the FileName field blank.
  4. Double-click the cSplitter component to display its Basic settings view in the Component tab.
    In this use case, as we want to split the message into sub-messages at each person node of the XML file. Select XPath in the Language list and type in "/people/person") in the Expression field.
  5. Double-click the cSetHeader component, which is labeled Set_file_name to display its Basic settings view in the Component tab.
  6. Click [+] to add a row to the Headers table.
    In the Name field, type in the name of the header you want to give to the messages.
    Here, as we want to define the file name for each incoming message, fill in "CamelFileName" as the header name.
    Select Bean in the Language field and type in the name of the predefined Java Bean in the Value field, beans.setFileNames.class in this use case.
  7. Double-click the cProcessor component to display its Basic settings view in the Component tab, and customize the code so that the console will display information the way you wish.
    In this use case, we want to display the file name each message routed to the receiving endpoint, so we customize the code as follows:
    System.out.println("File received: "+ 
    exchange.getIn().getHeader("CamelFileName"));
  8. Press Ctrl+S to save your Route.